Closed grahitr closed 2 years ago
>>> from tidypandas import tidyframe >>> from palmerpenguins import load_penguins >>> penguins_tidy = tidyframe(load_penguins()) >>> penguins_tidy.filter(mask= (penguins_tidy.pull("sex") == "male")) --------------------------------------------------------------------------- UnboundLocalError Traceback (most recent call last) Input In [18], in <cell line: 1>() ----> 1 penguins_tidy.filter(mask= (penguins_tidy.pull("sex") == "male")) File ~/codes/tidypandas/src/tidypandas/tidyframe_class.py:1679, in tidyframe.filter(self, query, mask, by, **kwargs) 1666 res = (self.group_modify(lambda chunk: ( 1667 chunk.assign(**{"__mask": lambda x: handle_mask(query(x))}) 1668 .query("__mask") (...) 1675 ) 1676 ) 1677 res = res.relocate(self.colnames) -> 1679 if isinstance(res, pd.DataFrame): 1680 if query is None and mask is not None: 1681 res = self.__data.loc[mask, :] UnboundLocalError: local variable 'res' referenced before assignment