I'm a newbie in python and building Neural Network regression model in python.
I'm trying to exclude rows that have zero values in the pandas.DataFrame, but don't know how to...
For example, if I have csv like below
input1 input2 input3 input4 input5 y
370 17.40013 8.9 4 740 883.0246
370 17.35865 8.9 4 740 884.0846
370 17.30227 0 4 740 884.9326
370 17.32991 8.9 4 740 884.4379
370 17.55929 0 4 740 883.1424
370 17.6505 8.9 4 740 883.1188
and want to exclude rows that have zero values (3rd and 5th row above example).
My code for now is including all rows of data as below code,
s1 = pd.Series(RMR_list)
s2 = pd.Series(PHT_list)
s3 = pd.Series(KLNF_list)
s4 = pd.Series(KLNM_list)
s5 = pd.Series(IDF_list)
s6 = pd.Series(CCN_list)
df = DataFrame({'RMR': RMR_list, 'PHT': PHT_list, 'KLN_F': s3.reindex(s1.index), 'KLN_M': s4.reindex(s1.index), 'IDF_M': s5.reindex(s1.index), 'CCN': s6.reindex(s1.index)})
df = df.values
#Setting training data and test data
train_size_x = int(len(df)*0.8) #The user can change the range of training data
print(train_size_x)
X_train = df[0:train_size_x, 1:6]
t_train = df[0:train_size_x, 0]
X_test = df[train_size_x:int(len(df)), 1:6]
t_test = df[train_size_x:int(len(df)), 0]
Using 80% of my whole data as training data and the rest of them are test data. And I'm trying to exclude rows that have zero values from those training and test data.
How should I implement in python code..?
ps. I'm using python 3.6