今天要繼續講:Python Pandas 資料分析 - Series 單維度資料
1.根據順序取值
import pandas as pd
data=pd.Series(列表)
print(data[1])
2.根據所引取值
import pandas as pd
data=pd.Series(列表, index=索引列表)
print(data[索引])
數學統計相關
import pandas as pd
data=pd.Series([3, 10,20,5,-12])
print(data.sum(), data.max(), data.prod())
print(data.mean(), data.median(), data.std())
print(data.nlargest(3), data.nsmallest(2))
字串操作相關
import pandas as pd
data=pd.Series(["您好", "Python", "Pandas"])
print(data.str.lower(), data.str.upper(), data.str.len())
print(data.str.cat(sep=","), data.str.contains("P"))
print(data.str.replace("您好","Hello"))