Ask Your Question
0

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

asked 2020-08-23 20:27:05 +0100

anonymous user

Anonymous

updated 2020-08-23 21:33:57 +0100

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-08-23 22:54:47 +0100

Cyrille gravatar image

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

edit flag offensive delete link more

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: 2020-08-23 20:27:05 +0100

Seen: 249 times

Last updated: Aug 23 '20