Source code:
def train_cats(df):
for n,c in df.items():
if is_string_dtype(c): df[n] = c.astype('category').cat.as_ordered()
And the doc goes: “Change any columns of strings…inplace.”
If so, shouldn’t the last line of the source code be:
df[n] = c.astype('category').cat.as_ordered( inplace=True)
instead of
df[n] = c.astype('category').cat.as_ordered()
?