Analysis

[데이터마이닝] pandas-taxis 5lab

ialleejy 2024. 12. 5. 08:25

import seaborn as sns
import matplotlib.pyplot as plt
df=sns.load_dataset('taxis')
def payment():
   
    sns.scatterplot(data=df, x='fare', y='tip', hue='payment')
payment()

 

 

 


 

def pickup_dropoff():
    with sns.axes_style('white'):
        g = sns.catplot(x="pickup_borough", data=df, aspect=2,
                       kind="count", color='steelblue')
        k = sns.catplot(x="dropoff_borough", data=df, aspect=2,
                       kind="count", color='steelblue')
pickup_dropoff()

 

<result>

 


def passengers():
    sns.violinplot(x="passengers", y="total", data=df,
               palette=["lightblue", "lightpink"]);
passengers()

 

 


def pay_tip():
    sns.boxplot(x='payment', y='fare', data=df)
    plt.title('Fare by Payment Method')
    plt.show()

    sns.boxplot(x='payment', y='tip', data=df)
    plt.title('Tip by Payment Method')
    plt.show()
pay_tip()