BUG: read_csv function bug - null

This issue has been tracked 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-10-04
Star Count 35430
Watcher Count 1120
Fork Count 15089
Issue Count 3589

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date