factablot with seaborn python

时间:2016-08-01 17:23:48

标签: python pandas seaborn

我尝试用seaborn绘制一个factorplot 这是我的python代码:

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib import style
import pandas as pd
import seaborn as sns
import io
style.use('ggplot')
#load dataset into df2 dataframe
df2 = pd.read_csv('C:/Users/Demonstrator/Downloads/power.csv',delimiter=';')
#drop NaN rows from df2 to build df_no_missing  
df_no_missing = df2.dropna().copy()
df_no_missing.head()
df_no_missing['depassement'] = np.where((df_no_missing['P_ACT_KW'] - df_no_missing['P_SOUSCR']) < 0, 0, df_no_missing['P_ACT_KW'] - df_no_missing['P_SOUSCR'])
#build a factorplot
sns.factorplot(data=df_no_missing, x="TIMESTAMP", y="P_ACT_KW")

无法查看结果过程似乎很忙。

0 个答案:

没有答案