Comparing a dataframe on string lengths for different columns
问题 I am trying to get the string lengths for different columns. Seems quite straightforward with: df['a'].str.len() But I need to apply it to multiple columns. And then get the minimum on it. Something like: df[['a','b','c']].str.len().min I know the above doesn't work, but hopefully you get the idea. Column a , b , c all contain names and I want to retrieve the shortest name. Also because of huge data, I am avoiding creating other columns to save on size. 回答1: I think you need list