pd.to_numeric

df[u"平均気温(℃)"] = pd.to_numeric( df[u"平均気温(℃)"])

示例:

#平均气温为string类型,如果计算月平均值,需要转化为float
type(df[u"平均気温(℃)"][0])

pandas中列的字符串str转float格式

#string转float
df[u"平均気温(℃)"] = pd.to_numeric( df[u"平均気温(℃)"])
type(df[u"平均気温(℃)"][0])

pandas中列的字符串str转float格式

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2021-12-14
  • 2023-01-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-03-08
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案