I noticed a difference between two pandas version, and was wondering why that was the case / if it was an expected behaviour:
import pandas as pd df = pd.DataFrame(columns = ("Name", "Age")) df.loc = "Jane", 5 df.loc = "Riley", 24 df.dtypes
In my test:
- with Python 3.5 and Pandas 0.18.1, populating the dataframe does update the "object" dtype of the
Agevariable to "float64"
- with Python 3.7 and Pandas 0.23.4, populating the dataframe does not update the "object" dtype of the
Why is that? I couldn't find an explanation in the documentation.
Edit: I just noticed
df.infer_objects().dtypes, which might be particularly relevant... Did the automatic "inference" get ditched along the way?