Skip to content
Advertisement

Delete characters on python dataframe, the number of characters removed per line varies

JavaScript

i want the first line to remove 0 characters to the right, the second line to remove 8 characters to the right, The resulting data will have the following form

JavaScript

Thank you very much everyone. I am a newbie and my English is not very good. Hope everyone can help me

Advertisement

Answer

You can use Pandas’ string methods on column 'columnA'

rstrip

JavaScript

Not altering df

JavaScript

overwriting df

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement