snorkel-team / snorkel

A system for quickly generating training data with weak supervision
https://snorkel.org
Apache License 2.0
5.81k stars 857 forks source link

TypeError: apply_lfs_to_data_point() got an unexpected keyword argument 'axis' #1545

Closed MortenKP closed 4 years ago

MortenKP commented 4 years ago

Issue description

A clear and concise description of what the bug is.

Code example/repro steps

################################### This is my code ###################################

train is my data

from snorkel.labeling import PandasLFApplier from snorkel.labeling import labeling_function

@labeling_function() def check(x): return SPAM if "check" in x.text.lower() else ABSTAIN

@labeling_function() def check_out(x): return SPAM if "check out" in x.text.lower() else ABSTAIN

lfs = [check_out, check]

applier = PandasLFApplier(lfs=lfs) L_train = applier.apply(df=train)

################################### This is the error ###################################

0%| | 0/3224 [00:00<?, ?it/s]

TypeError Traceback (most recent call last)

in 4 5 applier = PandasLFApplier(lfs=lfs) ----> 6 L_train = applier.apply(df=train) c:\users\tier2_mkp\.conda\envs\snorkel-env\lib\site-packages\snorkel\labeling\apply\pandas.py in apply(self, df, progress_bar) 89 tqdm.pandas() 90 call_fn = df.progress_apply ---> 91 labels = call_fn(apply_fn, axis=1) 92 labels_with_index = rows_to_triplets(labels) 93 return self._numpy_from_row_data(labels_with_index) c:\users\tier2_mkp\.conda\envs\snorkel-env\lib\site-packages\tqdm\std.py in inner(df, func, *args, **kwargs) 754 # Apply the provided function (in **kwargs) 755 # on the df using our wrapper (which provides bar updating) --> 756 result = getattr(df, df_function)(wrapper, **kwargs) 757 758 # Close bar and return pandas calculation result c:\users\tier2_mkp\.conda\envs\snorkel-env\lib\site-packages\pandas\core\series.py in apply(self, func, convert_dtype, args, **kwds) 3589 else: 3590 values = self.astype(object).values -> 3591 mapped = lib.map_infer(values, f, convert=convert_dtype) 3592 3593 if len(mapped) and isinstance(mapped[0], Series): pandas\_libs\lib.pyx in pandas._libs.lib.map_infer() c:\users\tier2_mkp\.conda\envs\snorkel-env\lib\site-packages\pandas\core\series.py in f(x) 3576 if kwds or args and not isinstance(func, np.ufunc): 3577 def f(x): -> 3578 return func(x, *args, **kwds) 3579 else: 3580 f = func c:\users\tier2_mkp\.conda\envs\snorkel-env\lib\site-packages\tqdm\std.py in wrapper(*args, **kwargs) 750 # take a fast or slow code path; so stop when t.total==t.n 751 t.update(n=1 if not t.total or t.n < t.total else 0) --> 752 return func(*args, **kwargs) 753 754 # Apply the provided function (in **kwargs) TypeError: apply_lfs_to_data_point() got an unexpected keyword argument 'axis' ################################### ## Expected behavior I was just following the tutorial but with my own data. My data is a pandas column with text. ## System info * How you installed Snorkel (conda, pip, source): I followed the official instructions. I've tried with both pip and conda. * OS: Windows * Python version: 3.7 * Snorkel version: Tried with both 0.9.0 & 0.9.3