Why my python do not work with seaborn

Viewed 32434
import pandas as pd
import numpy as np
import sklearn
from scipy import stats
import matplotlib.pyplot as plt
import os
import seaborn as sns


sns.set(); np.random.seed(0)
x = np.random.randn(100)

sns.distplot(x)

I just copy the example from the documention,but I get such error,I have try to change the enviroment such in shell to run it .But fail too.

Traceback (most recent call last):
File "/Users/Betterwittyman/Desktop/job_25/别人的/pdf_model2.py", line 13, in <module>
sns.distplot(x)

TypeError: slice indices must be integers or None or have an __index__ method
3 Answers

May be the version is not up to date.so follow the below command it worked.

sudo pip install --upgrade seaborn

Related