Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. import pandas as pd
  2. from petl import cut, look, tocsv, fromcsv
  3. import numpy as np
  4. from sklearn.tree import DecisionTreeClassifier
  5.  
  6. Location = r'D:\python\Py\titanic.csv'
  7. datapetl = fromcsv(Location)
  8. data_fa = cut(datapetl,'Pclass', 'Fare', 'Age', 'Sex')
  9. tocsv(data_fa, r'D:\python\Py\titanic_fa2.csv')
  10. new_location = r'D:\python\Py\titanic_fa2.csv'
  11.  
  12. data_raw = pd.read_csv(Location, index_col='PassengerId')
  13. df_withna = pd.read_csv(new_location)
  14. df = df_withna[['Pclass', 'Fare', 'Age', 'Sex']].dropna()
  15. print df
  16. clf = DecisionTreeClassifier()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement