Skip to content

Instantly share code, notes, and snippets.

Paola Masuzzo pcmasuzzo

Block or report user

Report or block pcmasuzzo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
pcmasuzzo /
Last active Jan 23, 2019
Some useful seaborn snippets
# import
import seaborn as sns
import matplotlib.pyplot as plt
# white background in plots
# df is a pandas dataframe
# plot by column by variable 'var1', in 3 columns, coloring by variable 'var2'
grid = sns.FacetGrid(df, col='var1', col_wrap=3, hue='var2', size=4, palette='Set2')
pcmasuzzo /
Last active Aug 23, 2017
Some useful pandas operations on dataframes
# import
import numpy as np
import pandas as pd
# convert a pandas dataframe to numpy excluding a column
data_matrix = np.array(data[data.columns.difference(['col_to_exclude'])], dtype=float)
# add new column to existing dataframe from another array
df = df.assign(new_col=vector.values)
You can’t perform that action at this time.