First time here? Check out the FAQ!

Ask Your Question
0

Pandas in Sage : how to remove elements when the name of the column has white spaces inside it.

asked 4 years ago

anonymous user

Anonymous

updated 4 years ago

I am using Pandas from Sage and I have a stupid problem. I have a data bases whose column titles incorporate some "space characters" like Sortie de Chais 2019. Unfortunately, there is also a column untitled Sortie de Chais 2018 so I cannot use only Sortie as the name of the column. So a command like

df = df[df.Sortie de Chais 2019 != 0]

could not do the job. Of course if the name was Sortie_de_Chais_2019, the problem would disapear. But I cannot change the titles of the data base directly. I know the number of the column (in this case 26). So how can I manage my problem ?

Thanks for help

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 4 years ago

Cyrille gravatar image

The following URL https://medium.com/@chaimgluck1/working-with-pandas-fixing-messy-column-names-42a54a6659cd gives the answer.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 4 years ago

Seen: 299 times

Last updated: Aug 23 '20