如下所示:
import pandas as pd
from pandas import *
import numpy as np
data = Series([1,-999,2,-999,-1000,3])
print(data.replace(-999,np.nan))
print(data.replace([-999,-1000],np.nan))
print(data.replace([-999,-1000],[np.nan,0]))
print(data.replace({-999:np.nan,-1000:0}))
以上这篇pandas值替换方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持天达云。