pandas读取大csv报错:TypeError: ufunc ‘isnan‘ not supported for the input types, and the inputs could not
使用pandas读取csv:
BPIC_2017_df = pd.read_csv('./datasets_csv/BPI_Challenge_2017.csv', index_col=0)
但是由于csv数据集太大了,读取报错:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-58-93042d10a770> in <module>2
----> 3 BPIC_2017_df = pd.read_csv('./datasets_csv/BPI_Challenge_2017.csv', index_col=0)E:\anaconda3\envs\tf_keras\lib\site-packages\pandas\io\parsers.py in read_csv(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision)684 )685
--> 686 return _read(filepath_or_buffer, kwds)687 688 E:\anaconda3\envs\tf_keras\lib\site-packages\pandas\io\parsers.py in _read(filepath_or_buffer, kwds)456 457 try:
--> 458 data = parser.read(nrows)459 finally:460 parser.close()E:\anaconda3\envs\tf_keras\lib\site-packages\pandas\io\parsers.py in read(self, nrows)1194 def read(self, nrows=None):1195 nrows = _validate_integer("nrows", nrows)
-> 1196 ret = self._engine.read(nrows)1197 1198 # May alter columns / col_dictE:\anaconda3\envs\tf_keras\lib\site-packages\pandas\io\parsers.py in read(self, nrows)2229 2230 names, data = self._do_date_conversions(names, data)
-> 2231 index, names = self._make_index(data, alldata, names)2232 2233 # maybe create a mi on the columnsE:\anaconda3\envs\tf_keras\lib\site-packages\pandas\io\parsers.py in _make_index(self, data, alldata, columns, indexnamerow)1675 elif not self._has_complex_date_col:1676 index = self._get_simple_index(alldata, columns)
-> 1677 index = self._agg_index(index)1678 elif self._has_complex_date_col:1679 if not self._name_processed:E:\anaconda3\envs\tf_keras\lib\site-packages\pandas\io\parsers.py in _agg_index(self, index, try_parse_dates)1768 )1769
-> 1770 arr, _ = self._infer_types(arr, col_na_values | col_na_fvalues)1771 arrays.append(arr)1772 E:\anaconda3\envs\tf_keras\lib\site-packages\pandas\io\parsers.py in _infer_types(self, values, na_values, try_num_bool)1869 na_count = 01870 if issubclass(values.dtype.type, (np.number, np.bool_)):
-> 1871 mask = algorithms.isin(values, list(na_values))1872 na_count = mask.sum()1873 if na_count > 0:E:\anaconda3\envs\tf_keras\lib\site-packages\pandas\core\algorithms.py in isin(comps, values)441 # If the the values include nan we need to check for nan explicitly442 # since np.nan it not equal to np.nan
--> 443 if np.isnan(values).any():444 f = lambda c, v: np.logical_or(np.in1d(c, v), np.isnan(c))445 else:TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
具体错误为:
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
我的解决方法是把
BPIC_2017_df = pd.read_csv('./datasets_csv/BPI_Challenge_2017.csv', index_col=0)
中的", index_col=0"这个设置去掉,读取成功!!!
pandas读取大csv报错:TypeError: ufunc ‘isnan‘ not supported for the input types, and the inputs could not相关推荐
- acorr_ljungbox(data, lags = 1)报错:ufunc 'isnan' not supported for the input types, and the inputs cou
报错信息:ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to ...
- TypeError: ufunc ‘isnan‘ not supported for the input types, and the inputs could not be...可能的原因记录
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerc ...
- TypeError: ufunc ‘isinf‘ not supported for the input types, and the inputs could not be safely...
报错代码 np.isinf(Table) nmupy错误提示: TypeError: ufunc 'isinf' not supported for the input types, and the ...
- 成功解决TypeError: ufunc 'sqrt' not supported for the input types, and the inputs could not be safely co
成功解决TypeError: ufunc 'sqrt' not supported for the input types, and the inputs could not be safely co ...
- ufunc ‘isnan‘ not supported for the input types, and the inputs could not be safely
解决方案: 有可能是np.ndarray数组元素是object类型导致不能进行np.isnan()的判断,可以进行数组元素的转换: array = array.astype(np.float64) a ...
- Python: ufunc ‘bitwise_xor‘ not supported for the input types,....
错误: ufunc 'bitwise_xor' not supported for the input types, and the inputs could not be safely coerce ...
- Python——CSV读取大文件报错_csv.Error: field larger than field limit
Python--CSV读取大文件报错_csv.Error: field larger than field limit 使用Python读取较大的csv文件时,可能出现大字段,导致超过字段默认限制,从 ...
- Pandas读取中文文本文件报错:python ‘utf-8‘ codec can‘t decode byte 0xe3 in position 0: unexpected end of data
近日用pandas的read_csv读取中文文本文件时报错:python 'utf-8' codec can't decode byte 0xe3 in position 0: unexpected ...
- halcon 读取大图片 报错5504
halcon在读取一般分辨率的图片是没问题,但读取大图片时,例如线扫的图片动不动就有个好几百张,halcon读取时就报错了. 经过大神指点,原来halcon IDE 有两种模式:halcon和 hal ...
最新文章
- python内置方法就是内置函数_python内置函数
- 求最小子数组之二维篇
- ITK:将两个图像加在一起
- Metasploit--后渗透(一些基本操作方法)
- jquery调用asp.net 页面后台的实现代码
- nao机器人行走速度_数计学院学子在2020世界机器人大赛总决赛中荣获佳绩!
- C语言经典游戏开发,零基础也能打造微信飞机大战
- 使用ARCore+Unity概述
- 微型计算机是以微处理器为基础,在计算机中以微处理器为核心组成的微型计算机属于第几代计算机...
- vnc远程控制软件怎么用,vnc远程控制软件到底该怎么用,使用教程
- Unity3d 周分享(16期 2019.5.1 )
- 如何从零开始搭建公司自动化测试框架?
- java标签用setbounds_setBounds的用法
- 用python做公众号网页_使用python一步一步搭建微信公众平台(一)
- CAD绘图次序快捷键是什么?怎么用?
- [编译原理随记]正则表达式转为NFA状态图(Thompsion构造法)
- 内存占用少的linux桌面,不同桌面环境占用内存/CPU对比
- 查找代码文件中的非 ASCII 字符
- android : 小米手机 打开开发者 选项 PC 端 安装 apk
- JS生成唯一id方式介绍(UUID和NanoID)