摘要:
import pandas as pd df1 = pd.read_csv("examples\ex1.csv") print(df1) ''' a b c d message 0 1 2 3 4 hello 1 5 6 7 8 world 2 9 10 11 12 foo ''' df2 = pd 阅读全文
摘要:
from pandas import Series, DataFrame import numpy as np ser = Series(np.arange(3)) print(ser) ''' 0 0 1 1 2 2 dtype: int64 ''' #print(ser[-1]) # 整数索引会 阅读全文
摘要:
frame.irow(0)改为frame.iloc[0] 阅读全文
摘要:
ser.iget_value(2)改为ser.iat[2] 阅读全文
摘要:
from pandas import Series import numpy as np data = Series(np.random.randn(10), index=[['a','a','a','b','b','b','c','c','d','d'], [1,2,3,1,2,3,1,2,2,3 阅读全文
摘要:
frame.sortlevel(0)改为 frame.sort_index(0) 阅读全文
摘要:
data.ix[['b','d']] 报错AttributeError: 'Series' object has no attribute 'ix' 改为 data.loc[['b','d']] 阅读全文
摘要:
# pandas使用浮点值NaN(Not a Number)表示浮点和非浮点数组中的缺失数据。 from pandas import Series,DataFrame import pandas as pd import numpy as np string_data = Series(['aard 阅读全文
摘要:
df = DataFrame(np.random.randn(7,3)) df.ix[:5,1] = NA# 报错 AttributeError: 'DataFrame' object has no attribute 'ix'# 改为 df.iloc[:5,1] = NA 阅读全文
摘要:
from pandas import Series,DataFrame import pandas as pd obj = Series(['c','a','d','a','a','b','b','c','c']) print(obj.unique()) # 唯一值 ''' ['c' 'a' 'd' 阅读全文