I just converted to Python from R, and now I'm trying to read in data from a csv file. I was very annoyed with all my integer columns being treated as floats, and after some digging I see that this is the problem: NumPy or Pandas: Keeping array type as integer while having a NaN value
I see that the accepted answer gives me a hint as to where to go, but problem is that I have data with hundreds of columns, as is typical when doing data science, I suppose. So I don't want to specify for every column what type to use when reading in data with read_csv
. This is fixed automatically in R
.
Is it really this hard to use pandas to read in data in a proper way in Python?
Source: https://pandas.pydata.org/pandas-docs/version/0.24/whatsnew/v0.24.0.html#optional-integer-na-support