How can I draw scatter trend line on matplot? Python-Pandas

后端 未结 3 2080
天命终不由人
天命终不由人 2020-12-14 21:24

I want to draw a scatter trend line on matplot. How can I do that?

Python

import pandas as pd
import matplotlib.pyplot as plt
csv = pd.read_csv(\'/tm         


        
3条回答
  •  无人及你
    2020-12-14 22:10

    You also can use Seaborn lmplot:

    import seaborn as sns
    
    import pandas as pd
    
    from io import StringIO
    
    textfile = StringIO("""fee,time
    100,650
    90,700
    80,860
    70,800
    60,1000
    50,1200""")
    
    df = pd.read_csv(textfile)
    
    _ = sns.lmplot(x='fee', y='time', data=df, ci=None)
    

    Output:

提交回复
热议问题