Created
April 13, 2024 20:07
-
-
Save guidoschmidt/f2b69193c05609f450a00a0ae49cd7ce to your computer and use it in GitHub Desktop.
Revisions
-
guidoschmidt created this gist
Apr 13, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ import asyncio import numpy as np import pandas as pd async def fun2(x): return x * 2 async def main(): df = pd.DataFrame(np.arange(10), columns=['old']) df['new'] = await asyncio.gather(*(fun2(v) for v in df['old'])) print(df) asyncio.run(main())