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

后端 未结 3 2083
长情又很酷
长情又很酷 2020-12-10 02:45

I have a data frame that looks something like this:

defaultdict(, {\'XYF\':             TimeUS           GyrX           GyrY                    


        
3条回答
  •  既然无缘
    2020-12-10 03:10

    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)

提交回复
热议问题