I think there's something rather fundamental I have missed regarding calling functions.
I need to fill a column in one dataframe with the sum of the columns in another dataframe.
First I did something like:
So for each loop i add the sum of another column. This returned 'NaN' for all columns including at least one NaN value.
Then instead I did:
This seems to work just fine, or at least I get a sum instead of just NaN. Why would this be?
BTW: I know 'in range(1,genericreturnperiods+1)' might be non-pythonic, but I need to make it start at 1 not 0 - so 'x in range(genericreturnperiods)' alone wouldn't work.
I need to fill a column in one dataframe with the sum of the columns in another dataframe.
First I did something like:
1 2 |
for x in range ( 1 ,genericreturnperiods + 1 ): currentsum = sum (genericresults[ '%ddaylog' % x]) |
Then instead I did:
1 2 |
for x in range ( 1 ,genericreturnperiods + 1 ): currentsum = genericresults[ '%ddaylog' % x]. sum () |
BTW: I know 'in range(1,genericreturnperiods+1)' might be non-pythonic, but I need to make it start at 1 not 0 - so 'x in range(genericreturnperiods)' alone wouldn't work.