I like your package and i would like to use it for my portfolio.
So, i wish use my own data.
In your exemple.py, your import your data like:
def main():
returns, cov_mat, avg_rets = pfopt.create_test_data()
I try with my pandas dataframe data m:
m=
Out[92]:
Returna Returnb Returnc Returnd
Date
2017-01-05 -0.007472 -0.007472 -0.007472 -0.007472
2017-01-06 0.014726 0.014726 0.014726 0.014726
2017-01-09 -0.008241 -0.008241 -0.008241 -0.008241
2017-01-10 -0.001318 -0.001318 -0.001318 -0.001318
...
len(m)
Out[95]: 98
type(m)
Out[96]: pandas.core.frame.DataFrame
So i tried to change your code like:
def main():
returns, cov_mat, avg_rets = m
and i have the error:
Traceback (most recent call last):
File "", line 70, in
main()
File "", line 22, in main
returns, cov_mat, avg_rets = m
check the create_test_data() function to see how the data has been prepared. Your code suggests that you are new to Python: I can recommend https://www.learnpython.org/ for a good introduction. Good luck!
Hi Christian Zielinski,
I like your package and i would like to use it for my portfolio. So, i wish use my own data. In your exemple.py, your import your data like: def main(): returns, cov_mat, avg_rets = pfopt.create_test_data()
I try with my pandas dataframe data m: m= Out[92]: Returna Returnb Returnc Returnd Date
2017-01-05 -0.007472 -0.007472 -0.007472 -0.007472 2017-01-06 0.014726 0.014726 0.014726 0.014726 2017-01-09 -0.008241 -0.008241 -0.008241 -0.008241 2017-01-10 -0.001318 -0.001318 -0.001318 -0.001318 ... len(m) Out[95]: 98
type(m) Out[96]: pandas.core.frame.DataFrame
So i tried to change your code like: def main(): returns, cov_mat, avg_rets = m
and i have the error: Traceback (most recent call last):
File "", line 70, in
main()
File "", line 22, in main
returns, cov_mat, avg_rets = m
ValueError: too many values to unpack
If you can to help me, i thanks you a lot.