Do Any One Know About This Error In Python? How Can I Resolve This?
I am plotting the data with MapBoxGl Python Library on maps, here is my code which is taking the latitude, longitude and points from the Pandas DataFrame and trying to make the geo
Solution 1:
well, I got the correct answer for my question of course I removed all NAN values but still there were inf
values in my dataframe, so as Instructed by someone I tried to find the description of the whole column such as
df['column'].describe()
this line gave the min, max, mean std and other values, so my max value was going to inf, so I removed this inf value with the following command and it worked
df = df[~df.isin([np.nan, np.inf, -np.inf]).any(1)]
this solved my issue. Reference for the solution
Solution 2:
Are there any NaNs in your dataframe? If so, this issue seems to be related. Hard for me to tell what exactly is wrong without seeing the contents of the dataframe in question, but a possible fix is to remove any NaNs or other unserializable values before making the call to df_to_geojson().
Post a Comment for "Do Any One Know About This Error In Python? How Can I Resolve This?"