I have a dataframe with a column with dtype('int64'). The values in the column range from 0-10. The dataframe has 770K rows and 56 columns of different types. When I run the code below, I get dtype('int64'). I would have thought that the result would have been at a minimum to downcast to int32 or int16. Here's a replicable example.
import pandas as pd
df = pd.DataFrame([x for x in range(10)]*77000, columns=['recommendation'])
df.dtypes
df.recommendation.apply(lambda x: pd.to_numeric(x, downcast='integer')).dtypes
pd.to_numeric(df.recommendation,downcast='integer').dtypes