Please enable JavaScript.
Coggle requires JavaScript to display documents.
python (data wrangling (handling with missing values (Fill Up/Down (df…
python
data wrangling
-
dropping data
dropping NaNs:
df = df.dropna(axis=0) # remove any row with nans
df = df.dropna(axis=1) # remove any column with nans
dropping columns:
df = df.drop(labels=['Features', 'To', 'Delete'], axis=1)
dropping duplicates (changes idexes):
df = df.drop_duplicates(subset=['Feature_1', 'Feature_2'])
df = df.reset_index(drop=True)
changing datatypes
date: df.Date = pd.to_datetime(df.Date, errors='coerce')
numeric: df.Height = pd.to_numeric(df.Height, errors='coerce')
-
-
-
-
feature representation
categorical
df.satisfaction = df.satisfaction.astype('category', ordered = True, categories = ordered_satisfaction).cat.codes
df = pd.get_dummies(df, columns = ['vertebrates'])
-