久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Pandas 錯(cuò)誤 - 遇到無效值

Pandas error - invalid value encountered(Pandas 錯(cuò)誤 - 遇到無效值)
本文介紹了Pandas 錯(cuò)誤 - 遇到無效值的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我是熊貓新手.我下載并安裝了 Anaconda.然后我嘗試通過 Spyder 應(yīng)用程序運(yùn)行以下代碼:

I'm new to Pandas. I downloaded and installed Anaconda. Then I tried running the following code via the Spyder app:

import pandas as pd
import numpy as np

train = pd.read_csv('/Users/Ben/Documents/Kaggle/Titanic/train.csv')
train

雖然這會按我的預(yù)期打印數(shù)據(jù)幀,但它也會顯示這些錯(cuò)誤

Although this prints the dataframe as I expected, it also shows these errors

//anaconda/lib/python3.4/site-packages/pandas/core/format.py:1969: RuntimeWarning: invalid value encountered in greater
  has_large_values = (abs_vals > 1e8).any()
//anaconda/lib/python3.4/site-packages/pandas/core/format.py:1970: RuntimeWarning: invalid value encountered in less
  has_small_values = ((abs_vals < 10 ** (-self.digits)) &
//anaconda/lib/python3.4/site-packages/pandas/core/format.py:1971: RuntimeWarning: invalid value encountered in greater
  (abs_vals > 0)).any()

為什么會出現(xiàn)這些錯(cuò)誤?

Why am I getting these errors?

我剛剛在 IPython 筆記本中測試了上面的代碼,它可以正常工作.那么,我的 Spyder 安裝有問題嗎?任何幫助將不勝感激.

I just tested the above code in an IPython notebook and it works without errors. So, is there something wrong with my Spyder installation? Any help would be appreciated.

經(jīng)過一些測試,我可以讀取 CSV 的前 5 行而不會收到警告.因此,我懷疑 float64 類型列的第 6 行中的 NaN 會觸發(fā)警告.

After some testing, I can read the first 5 rows of the CSV without getting the warning. So, I suspect a NaN in the 6th row for a float64 type column is triggering the warning.

推薦答案

我有同樣的錯(cuò)誤,并確定這是一個(gè)錯(cuò)誤.這似乎是由 Spyder 的 DataFrame 中存在 NaN 值引起的.我已經(jīng)卸載并重新安裝了所有軟件包,但沒有任何影響.NaN 值受支持并且在 DataFrame 中完全有效,尤其是在它們具有 DateTime 索引的情況下.

I have the same error and have decided that it is a bug. It seems to be caused by the presence of NaN values in a DataFrame in Spyder. I have uninstalled and reinstalled all packages and nothing has effected it. NaN values are supported and are completely valid in DataFrames especially if they have a DateTime index.

最后,我決定按如下方式抑制此警告.

In the end I have settled for suppressing this warnings as follows.

import warnings
warnings.simplefilter(action = "ignore", category = RuntimeWarning)

這篇關(guān)于Pandas 錯(cuò)誤 - 遇到無效值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to install Selenium in a conda environment?(如何在 conda 環(huán)境中安裝 Selenium?)
get the CUDA and CUDNN version on windows with Anaconda installe(使用 Anaconda installe 在 Windows 上獲取 CUDA 和 CUDNN 版本)
How can I download Anaconda for python 3.6(如何下載適用于 python 3.6 的 Anaconda)
Using two different Python Distributions(使用兩個(gè)不同的 Python 發(fā)行版)
How can I install Anaconda aside an existing pyenv installation on OSX?(除了 OSX 上現(xiàn)有的 pyenv 安裝之外,如何安裝 Anaconda?)
Permanently set Python path for Anaconda within Cygwin(在 Cygwin 中為 Anaconda 永久設(shè)置 Python 路徑)
主站蜘蛛池模板: 热99| 伊人免费在线观看高清 | 免费成人高清 | 国产h视频| 亚洲男人网| 国产精品国产三级国产aⅴ中文 | 欧美精品在线观看 | 成人h免费观看视频 | 狠狠操天天操 | 狠狠色综合网站久久久久久久 | 欧美一级二级在线观看 | 亚洲精品国产一区 | 国产一级免费视频 | 欧美在线高清 | 日韩中文字幕2019 | 欧美在线视频网站 | 中文字幕精品一区二区三区精品 | 99re热精品视频国产免费 | 99久久精品国产毛片 | 午夜天堂精品久久久久 | 国产精品免费小视频 | 日韩精品一区二区三区在线播放 | 91在线| 日韩成人一区二区 | 无码一区二区三区视频 | 亚洲h视频 | 91免费看片 | 欧美一区二区三区在线播放 | 综合色播 | av一区二区三区四区 | 国产一区精品在线 | 亚洲视频在线观看 | 免费天天干 | 91欧美精品 | 亚洲精品自在在线观看 | xx视频在线观看 | 亚洲欧美激情国产综合久久久 | 欧美一级免费 | 欧美日韩精品久久久免费观看 | 污视频在线免费观看 | 欧美a级成人淫片免费看 |