Revision history [back]

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

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

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

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