Access the pandas.DataFrame column name with the character '.' in that

I have a pandas dataframe df. One of the columns is Project.Fwd_Primer.

I would like to access this column, however, when I use df.Project.Fwd_PrimerI get:

AttributeError.

Is there any other way to access this column or do I need to get rid of the period in it?

+4
source share
2 answers

Use []:

df['Project.Fwd_Primer']

Example:

import pandas as pd

df = pd.DataFrame({'Project.Fwd_Primer': {0: '1', 1: '2'}})

print (df)
    Project.Fwd_Primer
0                  1
1                  2

print (df['Project.Fwd_Primer'])
0    1
1    2
Name: Project.Fwd_Primer, dtype: object

EDIT:

You can also check access to the attribute in documents :

Attention

, index , . s.1 . . .

, , . s.min .

, , : , major_axis, minor_axis, , .

- , . s ['1'], s ['min'], s ['index'] .

Series/Panel 0.13.0.

+6

:

df['Project.Fwd_Primer']
+3

All Articles