I am trying to build a logistic regression model. After reading the data set . I am getting
AttributeError Traceback (most recent call last)
<ipython-input-1-b1fbf288405a> in <module>()
21 df.head(10) #This should print 10 rows
22
---> 23 df.target_names
24 df.feature_names
25
C:\Users\HP\Anaconda2\lib\site-packages\pandas\core\generic.pyc in __getattr__(self, name)
3612 if name in self._info_axis:
3613 return self[name]
-> 3614 return object.__getattribute__(self, name)
3615
3616 def __setattr__(self, name, value):
AttributeError: 'DataFrame' object has no attribute 'target_names'
This is what I have done
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn import preprocessing
# create header for dataset
header = ['age','bp','sg','al','su','rbc','pc','pcc',
'ba','bgr','bu','sc','sod','pot','hemo','pcv',
'wbcc','rbcc','htn','dm','cad','appet','pe','ane',
'classification']
# read the dataset
df = pd.read_csv("C:\Users\HP\Documents\machine learning project\Chronic_Kidney_Disease\chronic_kidney_disease_full.arff",
header=None,
names=header
)
# dataset has '?' in it, convert these into NaN
df = df.replace('?', np.nan)
# drop the NaN
df = df.dropna(axis=0, how="any")
df.head(10) #This should print 10 rows
df.target_names
df.feature_names
Can any one tell me why I am getting this error