Skip to main content
 首页 » 编程设计

python之Seaborn tsplot 错误

2025年02月15日8kenshinobiy

我正在运行以下代码并遇到此问题 -

"/usr/local/lib/python2.7/dist-packages/seaborn/timeseries.py:183: UserWarning: The tsplot function is deprecated and will be removed or replaced (in a substantially altered version) in a future release. warnings.warn(msg, UserWarning) ".

有人知道如何解决这个问题吗?

代码-

import numpy as np 
import tensorflow as tf 
import seaborn as sns 
import pandas as pd 
 
SEQ_LEN = 10 
def create_time_series(): 
  freq = (np.random.random()*0.5) + 0.1  # 0.1 to 0.6 
  ampl = np.random.random() + 0.5  # 0.5 to 1.5 
  x = np.sin(np.arange(0,SEQ_LEN) * freq) * ampl 
  return x 
 
for i in xrange(0, 5): 
  sns.tsplot( create_time_series() );  # 5 series 

请您参考如下方法:

根据评论:这是一个警告,而不是错误。您被警告您使用的功能将来会从 Seaborn 中删除。要么忽略警告,要么改用其他函数,例如 matplotlib.pyplot 中的 plt.plot()。