Skip to content

data input column name #15727

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
zhanghaoyue opened this issue Mar 17, 2017 · 2 comments
Closed

data input column name #15727

zhanghaoyue opened this issue Mar 17, 2017 · 2 comments
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Usage Question

Comments

@zhanghaoyue
Copy link

zhanghaoyue commented Mar 17, 2017

Code Sample, a copy-pastable example if possible

a = df[(df.Gold>=1)&(df.Gold.1>=1)]

Problem description

when I input a data series, it automatically name the variable name to 'Gold' and 'Gold 1' because the input has two 'Gold' column.
which leads to an issue when I want to use indexing. The dot is recognized as "Invalid Syntax".
My solution is to rename the column but I wonder if I miss anything or actually we can automatically name them as 'Gold_1' instead of 'Gold.1' when this situation occur.

@jreback
Copy link
Contributor

jreback commented Mar 18, 2017

attribute access is a convenience feature only, see the docs: http://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-access

you generally access via getitem, IOW

df['Gold 1']

@jreback jreback closed this as completed Mar 18, 2017
@jreback jreback added Indexing Related to indexing on series/frames, not to indexes themselves Usage Question labels Mar 18, 2017
@jreback jreback added this to the No action milestone Mar 18, 2017
@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Mar 18, 2017

@jreback the question was also about the dot, instead of underscore (the space was a typo in OP, it should be a dot). But @zhanghaoyue, there is already another issue for that: #8908 (but without discussion, also related is #14704). I agree that it would have been better to use underscore, but not sure we can change that now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Usage Question
Projects
None yet
Development

No branches or pull requests

3 participants