Reputation: 11460
I'm trying to get the min value of values in a column of times. If I take a subset of the data I'm able to do it:
print(df7.ix[3,'START_TIME'].min())
type(df7.ix[3,'START_TIME'].min())
output is returned correctly:
09:17:09
str
But if I try on the entire column this error is returned:
print(df7['START_TIME'].min())
output:
TypeError: unorderable types: str() <= float()
So there is some bad data that is tripping up the min method. Is there any way to call the method and skip the bad data?
Upvotes: 2
Views: 979
Reputation: 294218
It seems to me that you have both floats and strings in that one column.
See if this works:
print(df7['START_TIME'].astype(str).min())
If it does, then you also have floats in that column. You want to find them and deal with them.
my_floats_indices = [i for i, v in df7['START_TIME'].iteritems() if isinstance(v, float)]
Then look at them with
df7.loc[my_floats_indices, 'START_TIME']
See if you can fix your problem. Hope that helps.
Upvotes: 1