【问题标题】:CSV file unable to uploadCSV 文件无法上传
【发布时间】:2018-08-08 15:50:34
【问题描述】:

在进行简单线性回归时尝试加载 CSV 文件。当我尝试运行时,错误来了 - “文件名”不存在作为文件/目录。我需要将文件保存在特定文件夹或目录中吗?

【问题讨论】:

  • 你能贴出你试过的代码吗?
  • filename = 'insurance.csv' dataset = load_csv(filename) for i in range(len(dataset[0])): str_column_to_float(dataset, i)
  • FileNotFoundError Traceback (最近一次调用最后一次) in () 1 filename = 'insurance.csv' ----> 2 dataset = load_csv(filename ) 3 for i in range(len(dataset[0])): 4 str_column_to_float(dataset, i) in load_csv(filename) 2 def load_csv(filename): 3 dataset = list() ----> 4 with open(filename, 'r') as file: 5 csv_reader = reader(file) 6 for row in csv_reader: FileNotFoundError: [Errno 2] No such file or directory: 'insurance.csv'跨度>

标签: python-3.x jupyter-notebook linear-regression


【解决方案1】:

尝试使用完全限定路径,或者在主程序的同一目录中

【讨论】:

  • 我做到了。但它显示了无效的语法 .filename = (C:\Users\user\Downloads\insurance.csv)
猜你喜欢
  • 1970-01-01
  • 2020-01-12
  • 2019-10-25
  • 2021-02-09
  • 1970-01-01
  • 2017-12-21
  • 1970-01-01
  • 2018-07-04
  • 2013-09-20
相关资源
最近更新 更多