Skip to content

DOC: Backticks missing in pandas.DataFrame.query #40375

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

Closed
bersbersbers opened this issue Mar 11, 2021 · 9 comments · Fixed by #40400 or #40419
Closed

DOC: Backticks missing in pandas.DataFrame.query #40375

bersbersbers opened this issue Mar 11, 2021 · 9 comments · Fixed by #40400 or #40419
Labels
Docs expressions pd.eval, query
Milestone

Comments

@bersbersbers
Copy link

Location of the documentation

https://pandas.pydata.org/docs/dev/reference/api/pandas.DataFrame.query.html

Documentation problem

image

Suggested fix for documentation

Backticks should be shown for the second Area (cm^2).

@bersbersbers bersbersbers added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 11, 2021
@rhshadrach rhshadrach added expressions pd.eval, query and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 12, 2021
@rhshadrach rhshadrach added this to the Contributions Welcome milestone Mar 12, 2021
@rhshadrach
Copy link
Member

Thanks for the report @bersbersbers! PR to fix would be most welcome.

@sstiijn
Copy link
Contributor

sstiijn commented Mar 12, 2021

Hello, I am new to contributing to open source and I am trying to get started. I am following the contributing to pandas guide and this issue seems to be a good first issue to try and get started.

@sstiijn
Copy link
Contributor

sstiijn commented Mar 12, 2021

take

@sstiijn
Copy link
Contributor

sstiijn commented Mar 12, 2021

@rhshadrach I think the first "Area (cm^2) is also missing a double quote at the end. Should I add that as well?

@jreback jreback modified the milestones: Contributions Welcome, 1.3 Mar 12, 2021
@bersbersbers
Copy link
Author

This is now online:
image

Shouldn't the second "Area (cm^2)" instead be marked as code with `double (in this case, triple) backticks, like here

pandas/pandas/core/frame.py

Lines 3806 to 3807 in 4007513

For example, if one of your columns is called ``a a`` and you want
to sum it with ``b``, your query should be ```a a` + b``.

and here

pandas/pandas/core/frame.py

Lines 3889 to 3890 in 4007513

For example, ```it's` > `that's``` will raise an error,
as it forms a quoted string (``'s > `that'``) with a backtick inside.

@sstiijn sstiijn removed their assignment Mar 13, 2021
@sstiijn
Copy link
Contributor

sstiijn commented Mar 13, 2021

@bersbersbers Good point. So concretely you would suggest that the docstring needs to be updated to

(For example, a column named "Area (cm^2)" would be referenced as ```Area (cm^2)```).
?

@bersbersbers
Copy link
Author

I have no way to test it, but I think yes.

@sstiijn
Copy link
Contributor

sstiijn commented Mar 13, 2021

@bersbersbers this would be the result

image

@bersbersbers
Copy link
Author

Makes a lot of sense to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs expressions pd.eval, query
Projects
None yet
4 participants