# Create duplicate dates and adding it to the dataframe
df2 = df.append(df.sample(n=5, replace=False)) # this line creates 5 duplicate rows
df2[['ds', 'yhat']].iplot(x='ds', y='yhat')
# plot link below
# Possible solution:
# Sort by date column
df2 = df2.sort_values(by='ds', ascending=True)
# Plot with sorted values
df2[['ds', 'yhat']].iplot(x='ds', y='yhat')
# plot link below
我试图通过添加重复的日期,用连接线在iplot()中重新创建绘图。消除这些行的一个解决方案是在绘图之前按x轴对数据框进行排序,即日期(此处为“ds”列)
Plot without duplicate dates using iplot()
Plot with duplicate dates and connecting lines using iplot()
Plot with duplicate dates using plot()
Plot with sorted date column with duplicate dates using iplot()
相关问题 更多 >
编程相关推荐