BUG: read_csv function bug - null

This issue has been created since 2022-09-22.

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
import numpy as np
np.set_printoptions(precision=3, suppress=True)
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow
import tensorflow.keras import layers #tensorflowversion = 2.4.0

df = pd.read.csv('data/train.csv')
pd.set_option('display.max_rows', df.shape[0]+1)
print(df)
#null = NaN

Issue Description

In my dataset are just some values and a colum with label as name.
One label has the name "null"
This converts the null in NaN which destroys my dataset completly.

Expected Behavior

Expected Behavior is that the string null is still "null" and not "NaN"

Installed Versions

INSTALLED VERSIONS

commit : 87cfe4e
python : 3.8.10.final.0
python-bits : 64
OS : Linux
OS-release : 3.10.0-1160.25.1.el7.x86_64
Version : #1 SMP Tue Apr 13 18:55:45 EDT 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.5.0
numpy : 1.23.3
pytz : 2022.2.1
dateutil : 2.8.2
setuptools : 62.3.2
pip : 20.2.4
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.9.1
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None
None

phofl wrote this answer on 2022-09-22

Hi, thanks for your report.

read_csv has an option to set which values should be interpreted as null, did you try that?

More Details About Repo
Owner Name pandas-dev
Repo Name pandas
Full Name pandas-dev/pandas
Language Python
Created Date 2010-08-24
Updated Date 2022-09-29
Star Count 35373
Watcher Count 1123
Fork Count 15031
Issue Count 3581

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Bad dependency is breaking the tool 0 2019-03-01 2022-09-12
Running Time series simulation of the European Low Voltage Test Feeder with 3 phase asymmetric loads 3 2022-06-02 2022-09-01
pandapower.select_subnet() function changes the dtype of the bus index 0 2022-06-03 2022-09-03
Character creation wrong location 1 2019-12-10 2022-08-17
Creating Accounts (email) with a capital Letter causes Problems 2 2020-01-03 2022-08-17
Should use array.strides to detect byte stride instead of specifying 1 2020-08-02 2022-09-28
How to force functions into TOC? 1 2021-01-24 2022-07-14
error in Docusaurus guide 1 2021-02-19 2022-07-28
should bramble complain about built-in directives declared in spec? 3 2022-08-30 2022-09-28
Enabling/Disabling schema introspection 6 2022-09-08 2022-09-28
use separate docker-compose projects for tests and local dev databases 4 2022-03-22 2022-09-28
When is the new release scheduled 0 2022-09-05 2022-09-25
Django 1.11 support on python 3 2 2020-07-03 2022-07-02
Поддержка Accelerate фреймворка 1 2020-07-16 2022-07-18
Updates to User Menu 0 2021-03-10 2022-09-08
Add support for virtual pointer protocol 3 2020-03-18 2022-09-02
对 powerline 的支持 0 2021-12-31 2022-01-20
SubscribeToUserDataUpdatesAsync not responding? 1 2021-08-20 2022-09-01
Zergpool added TLS/SSL support today 4 2022-03-29 2022-09-27
Stuck when idle and minimized 19 2021-09-09 2022-09-03
'TypeError: offset required' when using Heatmap.js with local tests 1 2020-12-01 2022-09-01
Additional (optional) dependency 0 2021-07-27 2022-09-23
Smooth staggered repetition with overlapping elements, or Only delay the first loop? 4 2017-07-20 2022-02-05
Mismatched ID on on server side render app even with react 18 2 2022-09-24 2022-09-21
Release v4.1.0 of GOV.UK Frontend 1 2022-04-21 2022-07-12
Building engines as static libraries is not supported 0 2021-01-20 2022-08-03
Threshold value having no effect (SvelteKit) 1 2022-01-18 2022-09-13
Clarifying the Overview 6 2022-03-03 2022-09-22
how to test hypermorph? 6 2021-04-05 2022-09-11
[Bug]: PUPPETEER_EXECUTABLE_PATH not respected on Linux/aarch64 1 2022-02-09 2022-09-28
Unsupport k8s 1.20? 2 2022-01-19 2022-08-19
DO Apps fail to due to the fixed timeout 0 2021-04-26 2022-09-27
How to use new blocks instead of "legacy" blocks 4 2022-03-25 2022-09-12
Return a 503 not a 404 when all instances down 9 2021-12-16 2022-09-28
port: Update README (#5919) 0 2021-10-18 2022-09-08
dbg_dmp should display current parser position 0 2021-03-29 2022-09-21
Add Previous and Next Page to Tutorial Layout 4 2020-08-04 2022-08-14
Allow logical OR for issue labels 2 2022-05-13 2022-09-21
fix video not upload 4 2020-04-09 2022-09-24
How to RM.inject wait onInitialized finished 8 2021-12-08 2022-09-15
Too many useless logs when the broker runs normally 0 2022-09-15 2022-09-21
[Android]当slider中嵌套scroller的时候,scroller设置flex:1,scroller并没有占满父视图 1 2019-06-24 2022-09-26
BatchConsumeQueue is treated as consume queue in slave node when create topic and send messages immediately 0 2022-09-15 2022-09-21
Support cross-compilation 4 2022-09-15 2022-09-21
wazuh agent v4.3.1 cannot resolve wazuh manager domain name 2 2022-06-01 2022-09-20
Show Containing Symbol In Inline Reference View 1 2022-05-04 2022-06-26
Version 4.5.2 channel invitation link is not working 2 2022-03-17 2022-09-22
jetpack compose out of memory when use coil + jetpack navigation+ jetpack paging 1 2022-09-09 2022-09-22
Celery Worker docker healthcheck causes a memory leak 6 2022-01-21 2022-08-16
Running airflow dags test <dag_id> <execution_dt> results in error when run twice. 4 2022-01-21 2022-08-16