Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Website should copy code only #56388

Open
1 task done
6801318d8d opened this issue Dec 7, 2023 · 2 comments
Open
1 task done

DOC: Website should copy code only #56388

6801318d8d opened this issue Dec 7, 2023 · 2 comments
Labels
Dependencies Required and optional dependencies Docs

Comments

@6801318d8d
Copy link

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#splitting-an-object-into-groups

Documentation problem

When I click on "Copy" in a code cell, everything is copied, including shell prompt, output, and dots that substitue for indentation.

Instead, only code should be copied.

That is, when I click on "copy" in the code cell in the link above, it copies:

In [1]: speeds = pd.DataFrame(
   ...:     [
   ...:         ("bird", "Falconiformes", 389.0),
   ...:         ("bird", "Psittaciformes", 24.0),
   ...:         ("mammal", "Carnivora", 80.2),
   ...:         ("mammal", "Primates", np.nan),
   ...:         ("mammal", "Carnivora", 58),
   ...:     ],
   ...:     index=["falcon", "parrot", "lion", "monkey", "leopard"],
   ...:     columns=("class", "order", "max_speed"),
   ...: )
   ...: 

In [2]: speeds
Out[2]: 
          class           order  max_speed
falcon     bird   Falconiformes      389.0
parrot     bird  Psittaciformes       24.0
lion     mammal       Carnivora       80.2
monkey   mammal        Primates        NaN
leopard  mammal       Carnivora       58.0

In [3]: grouped = speeds.groupby("class")

In [4]: grouped = speeds.groupby(["class", "order"])

While it should copy:

speeds = pd.DataFrame(
     [
         ("bird", "Falconiformes", 389.0),
         ("bird", "Psittaciformes", 24.0),
         ("mammal", "Carnivora", 80.2),
         ("mammal", "Primates", np.nan),
         ("mammal", "Carnivora", 58),
     ],
     index=["falcon", "parrot", "lion", "monkey", "leopard"],
     columns=("class", "order", "max_speed"),
)

grouped = speeds.groupby("class")

grouped = speeds.groupby(["class", "order"])

Suggested fix for documentation

See above

@6801318d8d 6801318d8d added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 7, 2023
@mroeschke
Copy link
Member

Thanks for the report. Looks like sphinx-togglepromt is broken for the latest sphinx jurasofish/sphinx-toggleprompt#23

Might be a good idea to look for a new dependnecy

@mroeschke mroeschke added Dependencies Required and optional dependencies and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 7, 2023
@6801318d8d
Copy link
Author

6801318d8d commented Dec 8, 2023

Thanks for the report. Looks like sphinx-togglepromt is broken for the latest sphinx jurasofish/sphinx-toggleprompt#23

Might be a good idea to look for a new dependnecy

It's my understanding that the git version of that dependency works with Sphinx 6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependencies Required and optional dependencies Docs
Projects
None yet
Development

No branches or pull requests

2 participants