python - Using dataframe in a class to filter results -


i've created class preprocess document pandas dataframes. however, i'm having trouble using filters within class. code below:

class dataframe:     def __init__(self, my_dataframe):         self.my_dataframe = my_dataframe         self.my_dataframe = self.filter_priv()      def filter_priv(self):         df = self.my_dataframe.copy()         df = df[~(df.priv_id > -1) | ~(df.restriction_level > 0)]  df1 = dataframe(df)  df 

my output non filtered results. input file has 262,000 records, , filter, when called outside class filters df down 11,000 records. ideas why not filter in class?

you're problem might you're using variable "df" initialize dataframe class, variable df hasn't been defined yet...


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -