csv文件带有路径的话不能直接调用read_csv()函数

 

import pandas as pd

pd.read_csv(F:\hand on machine learning with scikit learn and tensorflow\housing.csv)

将发生错误

 

 

正确形式是先调用open()函数,再调用read_csv()函数

import pandas as pd

pd.read_csv(open("F:\hand on machine learning with scikit learn and tensorflow\housing.csv"))

注意:路径和文件名作为字符串要用引号包含。

相关文章:

  • 2021-11-05
  • 2021-11-20
  • 2022-12-23
  • 2021-12-14
  • 2021-11-23
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-16
  • 2022-12-23
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案