def option0(): arr0 = ['2019/1', '2019/2', '2019/3', '2019/4', '2019/5', '2019/6', '2019/7', '2019/8', '2019/9', '2019/10', '2019/11', '2019/12', '2020/1', '2020/2', '2020/3', '2020/4', '2020/5', '2020/6', '2020/7', '2020/8', '2020/9', '2020/10', '2020/11', '2020/12'] date_arr = [] for date_str in arr0: date_obj = datetime.strptime(date_str, '%Y/%m') date_arr.append(date_obj.timestamp()) arr1 = np.array(input("请输入连续24个月的配件销售数据,元素之间用空格隔开:").split(), dtype=float) data_array = np.vstack((date_arr, arr1)).T.astype(float) df = pd.DataFrame(data_array, columns=['x', 'y']) df = df.dropna() acf, q, p = sm.tsa.acf(df['y'], nlags=20, qstat=True) if (p < 0.05).any(): print('时间序列具有短期依赖性') else: print('时间序列没有短期依赖性') acf, q, p = sm.tsa.acf(df['y'], nlags=20, fft=True, qstat=True) if (p < 0.05).any(): print('时间序列具有周期性') else: print('时间序列没有周期性') adf_result = sm.tsa.stattools.adfuller(df['y']) if adf_result[1] < 0.05: print('时间序列是平稳的') else: print('时间序列不是平稳的') res = sm.tsa.seasonal_decompose(df['y'], model='additive', period=12) if np.isnan(res.seasonal).any(): print('时间序列没有明显的季节性变化') else: print('时间序列存在季节性变化') pass,python def函数用web接口进行封装