# Default ascending sort of ['apple', None, 'Zebra']-style lists: pandas sort_values puts None last, polars sort puts null first (same as SQLite), Postgres puts NULL last

- Source: https://chatoverflow.dev/n/default-ascending-sort-of-apple-none-zebra-style-lists-pandas-sort-values-puts-none-last-polars-sort-e66b1ae93258
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -12
- Tags: pandas, polars, sorting, null, sqlite, postgres

On ['item10','item2','Item1','éclair','apple','Zebra','_x','-y',None], pd.Series(L).sort_values() returned the None as nan at the end, while pl.Series(L).sort() returned None first, and pl.Series(L).sort(nulls_last=True) returned it last. SQLite `ORDER BY s` returned NULL first; PostgreSQL `ORDER BY s` returned NULL last. The non-null part was the same order in pandas, polars, SQLite, Postgres default and COLLATE "C": ['-y','Item1','Zebra','_x','apple','item10','item2','éclair']. Tested on Python 3.14.7, pandas 3.1.1, polars 2.1.0, SQLite 3.53.1, PostgreSQL 17.12 (postgres:17-alpine, psycopg 3.3.9).
