pandas读取文件报错
path = 'D:/Postgraduate/Python/Machine Learning/小象学院机器学习/08、回归实践/8.Regression代码/8.Regression/8.Advertising.csv'
data = pd.read_csv(path)
x = data[['TV','Radio','Newspaper']]
y = data['Sales']
data
报错了,OSError: Initializing from file failed
报错原因在于文件路径中有中文,所以可以改为如下:
path = 'D:/Postgraduate/Python/Machine Learning/小象学院机器学习/08、回归实践/8.Regression代码/8.Regression/8.Advertising.csv'
f = open(path)
data = pd.read_csv(f)
x = data[['TV','Radio','Newspaper']]
y = data['Sales']
data
pandas读取文件报错的更多相关文章
- Pandas读取文件报错UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte
pandas读取文件时报UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start by ...
- 【python】python读取文件报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 2: illegal multibyte sequence
python读取文件报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 2: illegal multibyte ...
- python3运行时候报错集锦:读取文件报错
1.关于读取文件报错: 命令执行到cf.read(cfpath),出现如下报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa0 in po ...
- python读取文件报错:pandas.errors.ParserError: iterator should return strings, not bytes (did you open the file in text mode?)
python 读取csv文件报错问题 import csv with open('E:/Selenium2script/DDT模块/test.csv','rb') as f: readers = cs ...
- 用pandas读取excel报错
用pandas.read_execl()方法读取excel文件报错. 后来导入xlrd第三方库,就好了.
- pandas中读取文件报错
import pandas as pd fileName = "路径中带有中文/xxx.csv" tf_train = pd.read_csv(fileName) 会提示报错 OS ...
- 【Python】Python读取文件报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0x99 in position 20: illegal multibyte sequence
环境描述 text.txt 今天的天气不错 是个皻的选择 读取文件的代码 #!/usr/bin/python #-*- coding:UTF-8 -*- f = open(r'D:\Python\Py ...
- namenode磁盘满引发recover edits文件报错
前段时间公司hadoop集群宕机,发现是namenode磁盘满了, 清理出部分空间后,重启集群时,重启失败. 又发现集群Secondary namenode 服务也恰恰坏掉,导致所有的操作log持续写 ...
- php中读取中文文件夹及文件报错
php读取时出现中文乱码 一般php输出中出现中文乱码我们可用 header ('content:text/html;charset="utf-8"'); php中读取中文文件夹及 ...
随机推荐
- React组件间的通信
1.子组件调用父组件,采用props的方式进行调用和赋值,在父组件中设置相关属性值或者方法,子组件通过props的方式进行属性赋值或者方法调用: 2.父组件调用子组件,采用refs的方式进行调用,需要 ...
- 解决TextView drawableRight左侧图片大小不可控的问题
通过代码来修改图片的大小: Drawable rightDrawable= context.getResources().getDrawable(R.drawable.more); rightDraw ...
- Nginx 反向代理504 Gateway Time-out
location /ssfwpt { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_ ...
- gdb fabs错误输出
https://sourceware.org/gdb/wiki/FAQ GDB doesn't know the return type nor the type of the arguments f ...
- CentOS 7.4安装nodejs & nginx & pm2
一.安装nodejs1.查看操作系统信息 uname -a cat /etc/centos-release 2.安装wget yum install wget -y3.安装nodejs 1.下载 wg ...
- 在mysql命令行下执行sql文件
***********在mysql命令行下执行sql文件*********** C:\Windows\system32>cd E:\MySQL\mysql-5.7.16-winx64\bin / ...
- 【Spark深入学习 -14】Spark应用经验与程序调优
----本节内容------- 1.遗留问题解答 2.Spark调优初体验 2.1 利用WebUI分析程序瓶颈 2.2 设置合适的资源 2.3 调整任务的并发度 2.4 修改存储格式 3.Spark调 ...
- HTML中 javascript 相对根路径问题
在HTML文档中,有很多引用的JS或者CSS文件,一般都是用相对路径来引用的,例如: ./../.. ,但是,有没有类似ASP.NET中的路径: ~/Scripts/myScript.js 但是有的: ...
- oracle sql 获取本季度所有月份,上季度所有月份
上季度所有月份: ),-ROWNUM),'YYYYMM') LAST_Q A FROM DUAL) CONNECT ; 本季度所有月份: ),-ROWNUM),'YYYYMM') LAST_Q FRO ...
- opencv wlsfilter depth refinement demo
参考 https://docs.opencv.org/3.2.0/d3/d14/tutorial_ximgproc_disparity_filtering.html // This file is p ...