common Pandas functions and their equivalent functions in the polars library:
pd.read_csv
:polars.read_csv
pd.DataFrame
:polars.DataFrame
df.head
:df.first
df.tail
:df.last
df.describe
:df.summary
df.corr
:df.correlation
df.cov
:df.covariance
df.dropna
:df.remove_na
df.fillna
:df.fill_na
df.groupby
:df.aggregate
df.pivot_table
:df.spread
df.melt
:df.gather
df.merge
:df.join
These are some of the commonly used Pandas functions and their equivalent in polars library. It is possible that some functions may not have an equivalent in polars library and some additional functions may be available in polars library.
The polars library is a high-level library for data analysis and visualization in Python, built on top of the popular PyData stack (NumPy, Pandas, Matplotlib, etc.). Some common Pandas functions that have different names in polars include:
- Pandas ‘head’ function is called ‘first’ in polars
- Pandas ‘tail’ function is called ‘last’ in polars
- Pandas ‘drop’ function is called ‘remove’ in polars
- Pandas ‘groupby’ function is called ‘group’ in polars
- Pandas ‘agg’ function is called ‘aggregate’ in polars
- Pandas ‘pivot_table’ function is called ‘spread’ in polars
- Pandas ‘melt’ function is called ‘gather’ in polars
- Pandas’
cov
method is named ascovariance
in Polars. - The Pandas’
corr
method is named ascorrelation
in Polars. - Pandas’
groupby
method is named asaggregate
in Polars. - Pandas’
resample
method is named asdownsample
in Polars. - Pandas’
rolling
method is named aswindow
in Polars.
It’s important to note that polars library is not as widely used as Pandas, so if you’re familiar with Pandas, it may be best to stick with it, unless you have a specific use case for polars.