-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60f9862
commit 5f52953
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Why? | ||
|
||
You may think that pandas and Polars are quite similar. But are they really? | ||
|
||
For example, do the following produce the same output? | ||
|
||
```python | ||
import pandas as pd | ||
import polars as pd | ||
|
||
print(3 in pd.Series([1, 2, 3])) | ||
print(3 in pl.Series([1, 2, 3])) | ||
``` | ||
|
||
Try it out and see ;) | ||
|
||
How about | ||
```python | ||
df_left = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}) | ||
df_right = pd.DataFrame({'a': [1, 2, 3], 'c': [4, 5, 6]}) | ||
df_left.merge(df_right, left_on='b', right_on='c', how='left') | ||
``` | ||
versus | ||
|
||
```python | ||
df_left = pl.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}) | ||
df_right = pl.DataFrame({'a': [1, 2, 3], 'c': [4, 5, 6]}) | ||
df_left.join(df_right, left_on='b', right_on='c', how='left') | ||
``` | ||
|
||
? | ||
|
||
There are several such subtle difference between the libraries. By having a unified, | ||
simple, and predictable API, you can focus on behaviour rather than on slight implementation differences. | ||
|
||
Furthermore, both pandas and Polars frequently deprecate behaviour. By having a simple, predictable, and | ||
mostly stable API, which is tested nightly against the most recent commits from both pandas and Polars, | ||
you can develop with a lot more confidence. |