-
import pandas as pd a = [3,7,2] myvar = pd.Series(a,index=["x","y","z"]) print(myvar["x"]) #结果是3 #给序列赋值index ,然后可以根据index找到对应的数
-
data = {"col1": range(-5,0), "col2": range(5)} cdf = pd.DataFrame(data) print(cdf)
print(cdf.loc[2]) #取第三行的值
-
clear data
corr() method is a table with a lot of numbers that represents how well the relationship is between two columns.
import matplotlib.pyplot as plt
df.plot() #图标
plt.show()
pandas 更多用法参考一下:
Pandas - DataFrame Reference