I have this DataFrame:
df4=pd.DataFrame({'Date':['2020-05-19'],
'A':[153],
'B':[139],
'C':[165],
'D':[165],
'E':[123],
'F':[135],
'G':[137],})
df4['Date']=pd.to_datetime(df4['Date'])
df4 = df4.set_index('Date')
Then I transformed df in order to work with numpy
row=df4.to_records()[0]
amount = 10000
And I created this for loop:
for i in np.arange(1,len(row),1):
test=amount/row[i] if row[i]<=150 else 0
print(test)
This is the result of the variable test:
0
71.94244604316546
0
0
81.30081300813008
74.07407407407408
72.99270072992701
And I would like to know if there is a way to transform all the results of test into a numpy array? Hence the result should be something like this :
test = [0,71.94244604316546,0,0,81.30081300813008,74.07407407407408,72.99270072992701]
Thanks