Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seaborn Scatterplot matrix / pairplot integration #67

Closed
scls19fr opened this issue Feb 18, 2016 · 2 comments
Closed

Seaborn Scatterplot matrix / pairplot integration #67

scls19fr opened this issue Feb 18, 2016 · 2 comments

Comments

@scls19fr
Copy link
Contributor

import seaborn as sns
sns.set()

df = sns.load_dataset("iris")
sns.pairplot(df, hue="species")

displays

iris_scatter_matrix

but pairplot doesn't work the same way with ModelFrame

import pandas as pd
pd.set_option('max_rows', 10)
import sklearn.datasets as datasets
import pandas_ml as pdml  # https://github.com/pandas-ml/pandas-ml
import seaborn as sns
import matplotlib.pyplot as plt
df = pdml.ModelFrame(datasets.load_iris())
sns.pairplot(df, hue=".target")

iris_modelframe

There is some useless subplots

@sinhrks
Copy link
Member

sinhrks commented Feb 21, 2016

Both behaviors are valid. The difference is caused by its dtype.

Seaborn

Species columns is object. If it is changed to numeric, the column will be drawn.

df = sns.load_dataset("iris")

species, _ = df['species'].factorize()
df['species'] = species
sns.pairplot(df, hue="species")
# species column is included

pdml (scikit-learn)

Species columns is int. If it is changed to object, the column will not be drawn.

df = pdml.ModelFrame(datasets.load_iris())
df['.target'] = df['.target'].apply(lambda x: 'Species{0}'.format(x))
sns.pairplot(df, hue=".target")
# target column is excluded

@sinhrks sinhrks closed this as completed Feb 21, 2016
@scls19fr
Copy link
Contributor Author

Ok thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants