LoginSignup
1
0

polars unique sort

Posted at
import polars as pl

# Assuming you have a DataFrame called 'df'
# Here's a sample DataFrame for demonstration
data = {'A': [1, 2, 2, 3, 4],
        'B': ['a', 'b', 'b', 'c', 'c']}
df = pl.DataFrame(data)

# Get unique values from column 'B'
df = df.unique(subset=['B'])
df = df.sort('B')
print(df)
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0