Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- from petl import cut, look, tocsv, fromcsv
- import numpy as np
- from sklearn.tree import DecisionTreeClassifier
- Location = r'D:\python\Py\titanic.csv'
- datapetl = fromcsv(Location)
- data_fa = cut(datapetl,'Pclass', 'Fare', 'Age', 'Sex')
- tocsv(data_fa, r'D:\python\Py\titanic_fa2.csv')
- new_location = r'D:\python\Py\titanic_fa2.csv'
- data_raw = pd.read_csv(Location, index_col='PassengerId')
- df_withna = pd.read_csv(new_location)
- df = df_withna[['Pclass', 'Fare', 'Age', 'Sex']].dropna()
- print df
- clf = DecisionTreeClassifier()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement