##封装的工具-seaborn
import numpy as np
import pandas as pd
import seaborn as sns
df = pd.read_csv("E:/py_learning/day2/plot_df.csv")
##每一个点都显示出来,但当点多时,点对点会造成遮掩
df
sns.jointplot(x="x1",y="y",data=df)##注意这里引号的名字要与列表名字保持一致
sns.__version__
dir(sns)
##k代表黑色,因为b代表blue,kind表示内部形状
sns.jointplot(x="x1",y="y",kind="hex",color="k",data=df)
df = pd.read_csv("E:/py_learning/day2/titanic.csv")
df.dtypes
PassengerId object
Survived int64
Pclass int64
Name object
Sex object
Age float64
SibSp int64
Parch int64
Ticket object
Fare float64
Cabin object
Embarked object
dtype: object
df_select = df.loc[:,["Age","Fare","Sex"]]
sns.pairplot(data=df_select)
df_select_2 = df.loc[:,["Age","Fare","Fare"]]
##改列名
df_select_2.columns=["Age","Fare","Fare2"]
sns.pairplot(data=df_select_2)
##heatmap
np_data = np.random.rand(10,12) ##10行12列
sns.heatmap(data=np_data)