pandas – Python TypeError: cannot convert the series to when trying to do math on dataframe

pandas – Python TypeError: cannot convert the series to when trying to do math on dataframe

What if you do this (as was suggested earlier):

new_time = dfs[XYF][TimeUS].astype(float)
new_time_F = new_time / 1000000

Seems your initial data contains strings and not numbers. It would probably be best to ensure that the data is already of the required type up front.

However, you can convert strings to numbers like this:

pd.Series([123, 42]).astype(float)

instead of float(series)

pandas – Python TypeError: cannot convert the series to when trying to do math on dataframe

You can use from the pd.to_numeric(s)

Leave a Reply

Your email address will not be published.