Skip to content

Commit 76025f8

Browse files
committed
Sync pandas-fast-flexible-intuitive with the maintenance update of 'Fast, Flexible, Easy and Intuitive: How to Speed Up Your pandas Projects'
1 parent 1f752c6 commit 76025f8

3 files changed

Lines changed: 19 additions & 11 deletions

File tree

‎pandas-fast-flexible-intuitive/README.md‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ Corresponding data for ["Fast, Flexible, Easy and Intuitive: How to Speed Up You
44

55
## Running the Script
66

7+
Install the pinned dependencies first:
8+
9+
```bash
10+
$ python -m pip install -r requirements.txt
11+
```
12+
713
The module `tutorial/__main__.py` is the script that mimics the tutorial code. A `__main__.py` script has the effect of executing when the containing package is run as `python -m <packagename>`.
814

9-
Here is an example output (MacBook Pro, 3.1 GHz Intel Core i5):
15+
Here is an example output (Python 3.14, pandas 3.0.6):
1016

1117
```bash
1218
pandas-fast-flexible-intuitive$ python3 -m tutorial
@@ -17,32 +23,32 @@ Companion code to https://realpython.com/fast-flexible-pandas.
1723
Note: most of the functions here modify a Pandas DataFrame in-place,
1824
which is generally not great practice but used with caution here.
1925

20-
Python version: 3.6.6
21-
Pandas version: 0.23.2
26+
Python version: 3.14.6
27+
Pandas version: 3.0.6
2228

2329
Timing code ...
2430

2531
Best of 3 trials with 10 function calls per trial:
26-
Function `convert` ran in average of 1.348 seconds.
32+
Function `convert` ran in average of 0.374 seconds.
2733

2834
Best of 3 trials with 100 function calls per trial:
29-
Function `convert_with_format` ran in average of 0.025 seconds.
35+
Function `convert_with_format` ran in average of 0.018 seconds.
3036

3137
Best of 2 trials with 10 function calls per trial:
32-
Function `apply_tariff_loop` ran in average of 3.313 seconds.
38+
Function `apply_tariff_loop` ran in average of 1.338 seconds.
3339

3440
Best of 3 trials with 50 function calls per trial:
35-
Function `apply_tariff_iterrows` ran in average of 0.650 seconds.
41+
Function `apply_tariff_iterrows` ran in average of 0.326 seconds.
3642

3743
Best of 3 trials with 100 function calls per trial:
38-
Function `apply_tariff_withapply` ran in average of 0.202 seconds.
44+
Function `apply_tariff_withapply` ran in average of 0.067 seconds.
3945

4046
Best of 3 trials with 1000 function calls per trial:
41-
Function `apply_tariff_isin` ran in average of 0.004 seconds.
47+
Function `apply_tariff_isin` ran in average of 0.003 seconds.
4248

4349
Best of 3 trials with 1000 function calls per trial:
4450
Function `apply_tariff_cut` ran in average of 0.001 seconds.
4551

4652
Best of 3 trials with 1000 function calls per trial:
47-
Function `apply_tariff_digitize` ran in average of 0.001 seconds.
53+
Function `apply_tariff_digitize` ran in average of 0.000 seconds.
4854
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
numpy==2.5.3
2+
pandas==3.0.6

‎pandas-fast-flexible-intuitive/tutorial/__main__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from .timer import timeit
1313

1414

15-
# Two functions for conversion of object dtype to datetime
15+
# Two functions for conversion of str dtype to datetime
1616
# Note that you could also specify `parse_dates` within `pd.read_csv()`
1717
@timeit(repeat=3, number=10)
1818
def convert(df, column_name):

0 commit comments

Comments
 (0)