Skip to content

how can i read 'null' as a real str in read_excel #27240

@394659383

Description

@394659383

Code Sample, a copy-pastable example if possible

na_values = pandas.io.common._NA_VALUES.difference({'null','NULL'})
excelbook = pandas.read_excel(configpath,sheet_name=sheetIndex,index_col=False,na_values=na_values)

Problem description

there's a word 'null' in my excel file.but it become a NaN when pandas read it out.
then i cut 'null' from my own na_values and used it at pandas.read_excel,but it seems like it is invalid in read_excel because it still changed 'null' to NaN in result.

Dose it is a bug or i used it at a wrong way?

my environment:
python version:3.7.3
pandas version:0.24.2
system:windows7

Received output:
0 ......
1 ......
2 ......
3 ......
4 [1 5 '25' nan 10000 100000 25 1000]

Expected output:
0 ......
1 ......
2 ......
3 ......
4 [1 5 '25' 'null' 10000 100000 25 1000]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions