-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
df = [*things*]
df = df[df['price'] > 0]
Issue Description
TypeError: '>' not supported between instances of 'str' and 'int'
Expected Behavior
Where it happened and why is the only question. Obviously, you could assume I was trying to use a maths operator on a string, but that shouldn't be what happened.
I ran code containing the above in google colabs, worked fine. it was only in vscode the error came up. The data was via an api call, the same data, some 20 minutes after it was 1st called.
I fixed it with this, df['price'] = pd.to_numeric(df['price'], errors='coerce')
, easy, no problems.
The code was copy pasted, 1:1 no changes. I imagine colab may use an older version? Anyway, very minor issue but a bit odd. For whatever reason different versions have interpreted the exact same data as a different type.
Installed Versions
Latest stable version as of 11/05/2023 on vscode
Whatever Colab are using.