Skip to content
Advertisement

How to use apply() to change data in a pandas data frame to lowercase?

I have this pandas dataframe:

JavaScript

And what I want to do is use apply() with a function to convert all the data to lowercase. I couldn’t find anything on the internet showing how to do this, I am currently stuck with this.

JavaScript

however it gives me error that series object has no attribute lower. Any help greatly appreciated! Thanks!

Advertisement

Answer

That’s because column custid and age have a integer values. Integer value doesn’t have lower() function.

For example, if you want to change gen’s data to a lower case, you can implement it like below.

JavaScript
Advertisement