New to Pandas, so maybe I\'m missing a big idea?
I have a Pandas DataFrame of register transactions with shape like (500,4)
:
Time
df.sort_values(['Total Due'])
returns a sorted DF, but it doesn't update DF in place.
So do it explicitly:
df = df.sort_values(['Total Due'])
or
df.sort_values(['Total Due'], inplace=True)
My problem, fyi, was that I wasn't returning the resulting dataframe, so PyCharm wasn't bothering to update said dataframe. Naming the dataframe after the return keyword fixed the issue.
Edit:
I had return
at the end of my method instead of
return df
,
which the debugger must of noticed, because df
wasn't being updated in spite of my explicit, in-place sort.