Home > other >  Python small white the problem of processing data, a great god answer, thank you!!!!
Python small white the problem of processing data, a great god answer, thank you!!!!

Time:09-27




 
For group, frame in df. Groupby (' I ') :
For a in range (1, len (frame) + 1) :
If a==1:
Df [' sr] [a - 1]=None
The else:
Df [' sr] [a - 1]=np. The log (df [' stockreturn] [a - 1)/df [' stockreturn] [2] a -)

These are some panel data, 35 countries, each country 72 quarterly data, I think is behind the table plus stockreturn_lograte, namely logarithm yield,
T=1 as missing value, the other is logarithmic yield,
But this code error ValueError: setting an array element with a sequence.
Want to ask how to write,
  • Related