MCPcopy Index your code
hub / github.com/Giyn/DataMiningVisualizationSystem / DataFrame2NPArray

Function DataFrame2NPArray

App/utils.py:59–89  ·  view source on GitHub ↗
(dataSet:DataFrame, target = None)

Source from the content-addressed store, hash-verified

57 return res
58
59def DataFrame2NPArray(dataSet:DataFrame, target = None) :
60
61 x = []
62
63 y = []
64
65 for i in range(0, len(dataSet)) :
66
67 x.append([])
68
69 for j in dataSet.columns :
70
71 if(is_number(dataSet[j][i])) :
72
73 if (target is None or j != target):
74 x[i].append(float(dataSet[j][i]))
75 else:
76 y.append(float(dataSet[j][i]))
77
78 else :
79
80 if (target is None or j != target):
81 x[i].append(dataSet[j][i])
82 else:
83 y.append(dataSet[j][i])
84
85 if(target is None) :
86
87 return np.array(x)
88
89 return np.array(x), np.array(y)
90
91
92def is_number(s) :

Callers 3

test.pyFile · 0.85
fitFunction · 0.85
predictFunction · 0.85

Calls 1

is_numberFunction · 0.85

Tested by

no test coverage detected