Skip to content

Instantly share code, notes, and snippets.

@liannewriting
Last active November 9, 2021 17:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save liannewriting/2916c0796f080ff2e643a4029eb4519b to your computer and use it in GitHub Desktop.
Save liannewriting/2916c0796f080ff2e643a4029eb4519b to your computer and use it in GitHub Desktop.
data_cleaning_202001
# import packages
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import matplotlib
plt.style.use('ggplot')
from matplotlib.pyplot import figure
%matplotlib inline
matplotlib.rcParams['figure.figsize'] = (12,8)
pd.options.mode.chained_assignment = None
# read the data
df = pd.read_csv('sberbank.csv')
# shape and data types of the data
print(df.shape)
print(df.dtypes)
# select numeric columns
df_numeric = df.select_dtypes(include=[np.number])
numeric_cols = df_numeric.columns.values
print(numeric_cols)
# select non numeric columns
df_non_numeric = df.select_dtypes(exclude=[np.number])
non_numeric_cols = df_non_numeric.columns.values
print(non_numeric_cols)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment