0

I'm trying to read a column named Goods_Issue_Date_(GID)

How can I read this?

I tried:

Df.Goods_Issue_Date_(GID)

Returns Invalid Syntax

Henry Ecker
  • 34,399
  • 18
  • 41
  • 57
Cabo
  • 5
  • 3
  • What exactly are you trying to do with this column besides "read"? What have you tried? Post the relevant parts of the code of what you've tried – FinestRyeBread Jan 18 '22 at 21:35
  • I know the duplicate is specifically about spaces, but the same advice is true for any columns which are not valid attribute names. Either rename the columns as suggested by [this answer](https://stackoverflow.com/a/30514678/15497888) or use standard __get_item__ access with square braces [like this answer](https://stackoverflow.com/a/13758846/15497888) – Henry Ecker Jan 18 '22 at 22:22

1 Answers1

0

Using the following dataframe as an example

data = [['Carrots', "Tuesday"], ['Apples', "Monday"], ['Pears', "Sunday"]]
df = pd.DataFrame(data, columns = ['Product', 'Goods_Issue_Date_(GID)'])

df.head()

   Product Goods_Issue_Date_(GID)
0  Carrots                Tuesday
1   Apples                 Monday
2    Pears                 Sunday

You can select the Goods_Issue_Date_(GID) column like so

df['Goods_Issue_Date_(GID)']

0    Tuesday
1     Monday
2     Sunday
Name: Goods_Issue_Date_(GID), dtype: object
BoomBoxBoy
  • 1,770
  • 1
  • 5
  • 23