Python 出现futurewarning

```python
import pandas as pd
import numpy as np
l=['x1','x3','x4','x5','x6','x7','x8','x13']
data_1=data[l].copy()
data_1.index = range(1994,2014)
data_1.loc[2014]=None # 添加预测行
data_1.loc[2015]=None

```)

运行结果及报错内容

C:\Users\lenovo\AppData\Local\Temp\ipykernel_8608\285400504.py:16: FutureWarning: The default dtype for empty Series will be 'object' instead of 'float64' in a future version. Specify a dtype explicitly to silence this warning.
data_1.loc[2014]=None # 添加预测行
C:\Users\lenovo\AppData\Local\Temp\ipykernel_8608\285400504.py:17: FutureWarning: The default dtype for empty Series will be 'object' instead of 'float64' in a future version. Specify a dtype explicitly to silence this warning.
data_1.loc[2015]=None

将警报取消

如果只是不想要警告信息,可以在代码头部加上

import warnings
warnings.filterwarnings("ignore")

不过你这个问题本质是因为新追加的None行,没有指定明确的数据类型,你可以这样写替换最后两行
for _ in range(2):
   data_1 = data_1.append(pd.Series(dtype='float64'), ignore_index=True)