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)

NOTE: the Pandas core team discourages the use of inplace=True parameter because it should be deprecated in the future versions of Pandas.

Answer from MaxU - stand with Ukraine on Stack Overflow
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.sort_values.html
pandas.DataFrame.sort_values — pandas 3.0.2 documentation
For DataFrames, this option is only applied when sorting on a single column or label. na_position{‘first’, ‘last’}, default ‘last’ · Puts NaNs at the beginning if first; last puts NaNs at the end. ... If True, the resulting axis will be labeled 0, 1, …, n - 1. ... Apply the key function to the values before sorting.
🌐
W3Schools
w3schools.com › python › pandas › ref_df_sort_values.asp
Pandas DataFrame sort_values() Method
import pandas as pd data = { "age": [50, 40, 30, 40, 20, 10, 30], "qualified": [True, False, False, False, False, True, True] } df = pd.DataFrame(data) newdf = df.sort_values(by='age') Try it Yourself »
🌐
GeeksforGeeks
geeksforgeeks.org › pandas › python-pandas-dataframe-sort_values-set-1
Pandas Dataframe.sort_values() - GeeksforGeeks
November 29, 2024 - The sort_values() function in Pandas is a versatile tool for sorting DataFrames by specific columns, with multiple options for handling null values and choosing sorting algorithms.
🌐
Data Science Discovery
discovery.cs.illinois.edu › guides › Modifying-DataFrames › sorting-a-dataframe-with-pandas
Sorting a DataFrame Using Pandas - Data Science Discovery
Reset Code Run All to Here Python Output: By default, the ascending parameter is True indicating that the sorting will be done in ascending order (smallest value first, largest value last).
🌐
DataCamp
datacamp.com › tutorial › pandas-sort-values
Pandas Sort Values: A Complete How-To | DataCamp
September 25, 2020 - Learn pandas sort values techniques. Use the sort_values() function to reorder rows by columns. Apply sort_index() to sort rows by a DataFrame’s index.
Find elsewhere
🌐
freeCodeCamp
freecodecamp.org › news › how-to-sort-values-in-pandas
pandas.DataFrame.sort_values - How To Sort Values in Pandas
March 13, 2023 - We saw two code examples on how to sort data in Pandas in ascending or descending order. You can use the sort_values() method's ascending parameter to sort data in ascending or descending order.
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-sort-pandas-dataframe
How to Sort Pandas DataFrame? - GeeksforGeeks
Pandas provides a powerful method called sort_values() that allows to sort the DataFrame based on one or more columns. The method can sort in both ascending and descending order, handle missing values, and even apply custom sorting logic.
Published   December 2, 2024
🌐
Pandas
pandas.pydata.org › pandas-docs › version › 0.23 › generated › pandas.DataFrame.sort_values.html
pandas.DataFrame.sort_values — pandas 0.23.1 documentation
Extending Pandas · Release Notes · Enter search terms or a module, class or function name. DataFrame.sort_values(by, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last')[source]¶ · Sort by the values along either axis · Examples · >>> df = pd.DataFrame({ ...
🌐
Real Python
realpython.com › pandas-sort-python
pandas Sort: Your Guide to Sorting Data in Python – Real Python
June 13, 2023 - Learning pandas sort methods is a great way to start with or practice doing basic data analysis using Python. Most commonly, data analysis is done with spreadsheets, SQL, or pandas. One of the great things about using pandas is that it can handle a large amount of data and offers highly performant data manipulation capabilities. In this tutorial, you’ll learn how to use .sort_values() and .sort_index(), which will enable you to sort data efficiently in a DataFrame.
🌐
Medium
medium.com › @heyamit10 › pandas-custom-sort-order-a-practical-guide-for-beginners-816b1ad6f2ed
Pandas Custom Sort Order: A Practical Guide for Beginners | by Hey Amit | Medium
April 12, 2025 - Pandas is a powerful Python library primarily used for data manipulation and analysis. You might be wondering why it’s so popular among data scientists. Well, it’s the sheer versatility and efficiency it brings to data handling tasks! Whether you’re dealing with time series data, handling missing values, or merging data frames, Pandas has got you covered. ... Custom sorting ...
🌐
CodeSignal
codesignal.com › learn › courses › advanced-preprocessing-and-collecting-techniques › lessons › mastering-sorting-values-within-pandas-dataframe
Mastering Sorting Values within Pandas DataFrame
Today, we will explore sorting within a DataFrame using Python's pandas. We will delve into the sort_values() function, covering single and multi-column sorting and handling missing values.
🌐
Vultr Docs
docs.vultr.com › python › third-party › pandas › DataFrame › sort_values
Python Pandas DataFrame sort_values() - Sort Data by Values | Vultr Docs
December 27, 2024 - This code sorts the DataFrame df by the 'Age' column in ascending order, which is the default sorting order in sort_values(). Use the ascending=False parameter to sort a DataFrame in descending order.
🌐
Stack Overflow
stackoverflow.com › questions › 74596270 › pandas-sort-values-function-returning-data-frame-with-scattered-values
python - Pandas .sort_values() function returning data frame with scattered values - Stack Overflow
There was a string value in report_id, which was not being checked for in shortDesc[shortDesc['report_id'].str.isdigit().notnull()] I'm assuming since it probably first check if it was a digit, then it was changed if it was a number, I moved both checks to two lines, and that fixed it. I'm still confused as to why a string value in 'report_id' was affecting .sort_values(by="when") when report_id should not have had anything to do with the sort.
🌐
Pandas
pandas.pydata.org › pandas-docs › version › 0.23.4 › generated › pandas.DataFrame.sort_values.html
pandas.DataFrame.sort_values — pandas 0.23.4 documentation
Extending Pandas · Release Notes · Enter search terms or a module, class or function name. DataFrame.sort_values(by, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last')[source]¶ · Sort by the values along either axis · Examples · >>> df = pd.DataFrame({ ...