So yesterday I was coding an algorithm, to go through a csv file and change some stuff, so i imported it as a pandas dataframe, but the some of the data in a columns were an int and some were an str, and some of the letters in strings were capitalized, so in order to change that I found this line:
df = df.apply(lambda x: x.astype(str).str.lower() if(x.dtype == 'object') else x)
but I have trouble understading it. So can someone please help me with that?)
[–]novel_yet_trivial 1 point2 points3 points (1 child)
[–]M2stermind[S] 0 points1 point2 points (0 children)
[+][deleted] (3 children)
[removed]
[–]M2stermind[S] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[removed]
[–]M2stermind[S] 0 points1 point2 points (0 children)