pandas值替换方法

如下所示:

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}))

相关推荐