如何在 Python 中填充 "null" 值?我的时间序列数据有关键字 null 如何删除它们?

How to fill "null" values in Python? I have keyword null for a time series data how can I delete them?

我有如下数据

enter image description here

我想使用 pandas 或其他一些库删除那些 null。

谢谢。

如果您专门在 pandas 内寻找,我建议

# suppose you already have a DataFrame similar to this:
# import pandas as pd
# df = pd.DataFrame({'data': [1, None, 3, None, 5]})

# to remove null values, do:
# df.dropna(inplace=True)

# to impute null values, do:
# df.fillna(inplace=True)

More pandas reference

可能值得注意的是 None 在 python 中为“空”。

在pandas中使用dropna来实现这一点。

new_data = data.dropna(axis = 0, how ='any')