Skip to content

Commit 8b6fb23

Browse files
authored
Update pandas-parallel-multiprocessing.md
1 parent 0a02d0a commit 8b6fb23

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

content/til/programming/pandas/pandas-parallel-multiprocessing.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ A piece of demo code is shown below.
2424

2525

2626
```python
27-
from multiprocessing import Pool
2827
from multiprocessing.dummy import Pool as ThreadPool
2928

3029
import pandas as pd
@@ -38,7 +37,10 @@ def nice_func(name, age):
3837

3938
# Apply to dataframe
4039
def apply_to_df(df_chunks):
41-
df_chunks['tupled'] = df_chunks.apply( lambda x: nice_func( x['host_name'], x['host_country']), axis=1 )
40+
df_chunks['tupled'] = df_chunks.apply(
41+
lambda x: nice_func( x['host_name'], x['host_country']),
42+
axis=1
43+
)
4244
return df_chunks
4345
print('finished chunk')
4446

0 commit comments

Comments
 (0)