I created a list of lengths using the len() function, and it returned a list like this: {0: 101, 1: 101, 2: 101, 3: 100 ... }. When I use the max() and min() functions to find the index of the list, it simply returns the maximum and mininum index values (0 and n).
I created my lengths list in this way:
n = len(df.index)
lengths = {}
for i in range(0,n):
lengths[i] = len(df.at[i,'col'])
To find the maximum and minimum I used:
maximum = max(lengths)
minimum = min(lengths)
which produces an incorrect result.
When I append the list lengths as a column to my dataframe, and use
minimum = min(df.loc[:,'lengths'])
the result is correct.
What is wrong about my list method?