File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 99
1010import dill
1111import pandas as pd
12+ import psutil
1213from pandas .core .groupby import DataFrameGroupBy as PandaDataFrameGroupBy
1314from pandas .core .window .expanding import ExpandingGroupby as PandasExpandingGroupby
1415from pandas .core .window .rolling import RollingGroupby as PandasRollingGroupby
3233MEMORY_FS_ROOT = "/dev/shm"
3334
3435# By default, Pandarallel use all available CPUs
35- NB_WORKERS = max ( CONTEXT .cpu_count () // 2 , 1 )
36+ NB_PHYSICAL_CORES = psutil .cpu_count (logical = False )
3637
3738# Prefix and suffix for files used with Memory File System
3839PREFIX = "pandarallel"
@@ -441,7 +442,7 @@ class pandarallel:
441442 def initialize (
442443 cls ,
443444 shm_size_mb = None ,
444- nb_workers = NB_WORKERS ,
445+ nb_workers = NB_PHYSICAL_CORES ,
445446 progress_bar = False ,
446447 verbose = 2 ,
447448 use_memory_fs : Optional [bool ] = None ,
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ packages = find:
2222install_requires =
2323 dill >= 0.3.1
2424 pandas >= 1
25+ psutil
2526
2627[options.packages.find]
2728exclude =
You can’t perform that action at this time.
0 commit comments