Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3.  
  4. import pandas as pd
  5. import seaborn as sns
  6.  
  7. df = pd.read_csv("https://www.dropbox.com/s/76fjhstb836quul/cars-search-data.txt?dl=1", sep=';' )
  8. df.head(5)
  9.  
  10. df = df[pd.notnull(df['paliwo'])]
  11. df = df.drop(df.columns[4:], axis=1)
  12. df.head(4)
  13. df = df[~df.cena.str.contains("EUR")]
  14.  
  15.  
  16. df.cena = (df.cena.str.replace('PLN',''))
  17. df.cena = (df.cena.str.replace(',','.'))
  18. df.przebieg = df.przebieg.str.replace('km','')
  19.  
  20. df.cena = df.cena.apply(pd.to_numeric)
  21. df.rocznik = df.rocznik.apply(pd.to_numeric)
  22. df.przebieg = df.przebieg.apply(pd.to_numeric)
  23. df = df[df.przebieg<500000]
  24.  
  25. df.cena = df.cena / 1000
  26. df.head(10)
  27.  
  28. sns.set_style('ticks')
  29. g = sns.regplot(x=df["rocznik"], y=df["przebieg"], fit_reg=True, marker="+", line_kws={"color":"r","alpha":0.7,"lw":2})
  30. g.figure.set_size_inches(18.5, 10.5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement