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.

Comment From: jreback

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']

Comment From: jorisvandenbossche

@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: https://github.com/pandas-dev/pandas/issues/8908 (but without discussion, also related is https://github.com/pandas-dev/pandas/issues/14704). I agree that it would have been better to use underscore, but not sure we can change that now.