Parsing “NA” entries as NaN values when reading in a pandas dataframe

后端 未结 1 1254
面向向阳花
面向向阳花 2020-12-12 05:40

i am new to pandas. I have loaded csv using pandas.read_csv. i have tried not to specify dtype but it was way too slow. since it is a very large file, i also specified data

相关标签:
1条回答
  • 2020-12-12 06:08

    From the pd.read_csv docs:

    na_values : scalar, str, list-like, or dict, default None

    Additional strings to recognize as NA/NaN. If dict passed, specific per-column NA values. By default the following values are interpreted as NaN: ‘’, ... ‘NA’, ...`.

    Bold emphasis mine. These values are not tossed away, rather, they are converted to NaN. Pandas is smart enough to automatically recognise those values without you explicitly stating it.

    0 讨论(0)
提交回复
热议问题