I need to delete a certain value from all the column in my data frame.
Data frame description:
Data columns (total 13 columns): Column Non-Null Count Dtype --- ------ -------------- ----- 1 age_group_5_years 34842 non-null int64 2 race_eth 34842 non-null int64 3 first_degree_hx 34842 non-null int64 4 age_menarche 34842 non-null int64 5 age_first_birth 34842 non-null int64 The number inside the column indicates a category .
Example:
Age (years) in 5 year groups 1 = Age 18-29 2 = Age 30-34 3 = Age 35-39 The column contains int or float, I need to drop all the 9 values in the data frame. 9 indicates unknown values in the dataframe
df = df[df["column"].ne(9)]where.ne(9)means not equal to9.9? Do you want to drop the entire row, or replace withNaN?