python - pandas dtype conversion from object to string -


I have a CSV file containing some columns which are numbers and some strings are I when I myDF.dtypes then shows me all the string columns as object .

  1. Someone asked a related question about why this is done. Is it possible to reinclude the string from the dtype object?

  2. Also, in general, there is an easy way to reuse dtype to int64 and Float64 to int32 and float32 and save data size (in memory / disk)?

All strings are variable-length (which is the object is dtype). You can series.astype ('S32') if you want; But if you store it in a datafile or do a lot with it, then it will be done again for simplicity.

Some serial formats, e.g. HDFStore however stores the wire on the disk as a fixed-length string.

You can series.astype (int32) if you want and store it as a new type.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -