pandarallel icon indicating copy to clipboard operation
pandarallel copied to clipboard

Fix #191: `TypeError: 'generator' object is not subscriptable` when using colab

Open till-m opened this issue 2 years ago • 1 comments

Fix #191 Didn't find a way of doing this that doesn't convert the generator to a list, unfortunately.

To check that it works in colab (adapted from @agiveon's example):

!pip install -U --no-cache-dir https://github.com/till-m/pandarallel/archive/fix191.zip
from pandarallel import pandarallel
pandarallel.initialize(progress_bar=True)

import pandas as pd

data = {'Name': ['Tom', 'Joseph', 'Krish', 'John'], 'Age': [20, 21, 19, 18]}
df = pd.DataFrame(data)
df['HalfAge'] = df.parallel_apply(lambda r: r.Age/2,axis=1)

till-m avatar Aug 07 '22 11:08 till-m

I encounter the same issue. Could we review and merge it?

csqzhang avatar Aug 08 '22 16:08 csqzhang

Hi @csqzhang, @nalepae maintains this package in his spare time, so he's not always able to take care of reviews etc. immediately. Until then, feel free to either use a previous version without this bug by running !pip install pandarallel==1.6.1 (if what you are doing is not impacted by #74) or use the patched version by installing from my branch pip install https://github.com/till-m/pandarallel/archive/fix191.zip.

till-m avatar Aug 09 '22 06:08 till-m

Fixed in pandarallel v1.6.3. Thank you @till-m!

nalepae avatar Aug 09 '22 09:08 nalepae