[英]Seaborn tsplot - y-axis scale
我認為問題與現場unit
。 在將數據作為DataFrame
傳遞的情況下,該函數期望一個單位指示數據所屬的主題。 此功能行為對我來說並不明顯,但請參見此示例。
# Test Data
df = pd.DataFrame({'month': [1, 2, 3, 4, 5, 6],
'value': [11.5, 9.7, 12, 8, 4, 12.3]})
# Added a custom unit with a value = 1
sns.tsplot(data=df, value='value', unit=[1]*len(df), time='month')
plt.show()
您還可以使用提取Series
並將其繪制。
sns.tsplot(data=df.set_index('month')['value'])
plt.show()
我有同樣的問題。 在我的情況下,這是由於數據不完整所致,因此每個時間點至少都有一個缺失值,從而導致默認估算器為每個時間點返回NaN。
由於您僅顯示數據的前5條記錄,因此我們無法確定您的數據是否存在相同的問題。 您可以查看以下修復程序是否有效:
from scipy import stats
sns.tsplot(data = df_month, time = 'month',
value = 'pm_local',
estimator = stats.nanmean);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.