quantstats icon indicating copy to clipboard operation
quantstats copied to clipboard

ValueError: If using all scalar values, you must pass an index

Open fsitios opened this issue 11 months ago • 1 comments

Hi, I am getting the following error: "ValueError: If using all scalar values, you must pass an index" in this line "qs.utils.make_index(composicion_portfolio, rebalance=None, period='max')"

Code:

import pandas as pd
import quantstats as qs
qs.extend_pandas()
composicion_portfolio =  {'VOO':0.50,'QQQ':0.50}
qs.utils.make_index(composicion_portfolio,rebalance=None, period='max')

Any idea why I am having this error?

just in case, this is my full list of packages:

Package Version


absl-py 2.1.0 aiodns 3.0.0 aiohttp 3.9.3 aiosignal 1.2.0 alembic 1.13.1 appdirs 1.4.4 APScheduler 3.6.3 astunparse 1.6.3 async-generator 1.10 async-timeout 4.0.2 attrs 23.1.0 autopep8 1.5.7 backcall 0.2.0 beautifulsoup4 4.12.2 bleach 4.1.0 cachetools 4.2.2 ccxt 1.73.2 certifi 2023.7.22 cffi 1.15.0 charset-normalizer 2.0.4 chromedriver-autoinstaller 0.3.1 chromedriver-binary 97.0.4692.71.0 chromedriver-py 97.0.4692.71 clarabel 0.9.0 click 8.1.7 colorama 0.4.4 configparser 5.2.0 contourpy 1.2.1 cplex 20.1.0.3 crayons 0.4.0 cryptography 35.0.0 cvxopt 1.3.2 cvxpy 1.5.2 cycler 0.10.0 dateparser 1.1.0 debugpy 1.5.1 decorator 5.1.0 defusedxml 0.7.1 dill 0.3.6 distlib 0.3.4 docopt 0.6.2 docplex 2.22.213 ecos 2.0.14 entrypoints 0.3 et-xmlfile 1.1.0 exceptiongroup 1.1.3 fastjsonschema 2.19.1 filelock 3.4.2 flatbuffers 24.3.25 fonttools 4.52.4 free-proxy 1.1.1 frozendict 2.3.4 frozenlist 1.3.0 gast 0.5.4 google-pasta 0.2.0 greenlet 2.0.2 grpcio 1.63.0 h11 0.14.0 h5py 3.11.0 html5lib 1.1 ibapi 10.14.2 idna 3.4 imbalanced-learn 0.8.1 importlib-metadata 7.1.0 importlib-resources 6.4.0 ipykernel 6.5.0 ipython 7.29.0 ipython-genutils 0.2.0 jedi 0.18.1 Jinja2 3.0.3 joblib 1.4.2 jsonschema 4.2.1 jsonschema-specifications 2023.7.1 jupyter-client 7.0.6 jupyter-core 4.9.1 jupyterlab-pygments 0.1.2 keras 3.8.0 kiwisolver 1.3.2 libclang 18.1.1 lxml 4.9.3 Mako 1.3.2 Markdown 3.6 markdown-it-py 3.0.0 MarkupSafe 2.1.5 matplotlib 3.9.4 matplotlib-inline 0.1.3 mdurl 0.1.2 mistune 0.8.4 ml-dtypes 0.4.1 multidict 6.0.2 multitasking 0.0.9 mysql-connector-python 8.4.0 mysqlclient 2.1.1 namex 0.0.8 nbclient 0.5.9 nbconvert 6.3.0 nbformat 5.9.2 nest-asyncio 1.5.1 numpy 2.0.2 openpyxl 3.1.5 opt-einsum 3.3.0 optree 0.11.0 osqp 0.6.7.post0 outcome 1.1.0 packaging 21.3 pandas 2.2.3 pandas-datareader 0.10.0 pandocfilters 1.5.0 parso 0.8.2 pbr 6.0.0 pdfkit 1.0.0 peewee 3.17.5 pickleshare 0.7.5 pigar 2.1.6 Pillow 8.3.1 pip 21.1.1 pip-review 1.3.0 platformdirs 3.11.0 plotly 5.24.1 prompt-toolkit 3.0.22 protobuf 4.25.3 pyaes 1.6.1 pyaml 21.10.1 pyasn1 0.4.8 pycares 4.1.2 pycodestyle 2.7.0 pycparser 2.21 pyfinviz 1.0 pygments 2.18.0 pyOpenSSL 21.0.0 pyparsing 2.4.7 pyportfolioopt 1.5.6 pyrsistent 0.18.0 PySocks 1.7.1 python-binance 1.0.15 python-dateutil 2.8.2 python-dotenv 1.0.1 python-telegram-bot 13.8.1 pytz 2022.7.1 pytz-deprecation-shim 0.1.0.post0 pywin32 306 PyYAML 6.0 pyzmq 22.3.0 qdldl 0.1.7.post4 QuantStats 0.0.62 referencing 0.30.2 regex 2022.1.18 requests 2.31.0 requests-futures 1.0.1 rich 13.7.1 rounder 0.6.5 rpds-py 0.12.0 rsa 4.7.2 scikeras 0.13.0 scikit-learn 1.5.0 scipy 1.13.1 scs 3.2.6 seaborn 0.13.2 selenium 4.17.2 setuptools 60.9.0 six 1.16.0 sniffio 1.3.0 sortedcontainers 2.4.0 soupsieve 2.3.2.post1 SQLAlchemy 2.0.27 sqlparse 0.4.4 ta 0.11.0 tabulate 0.9.0 telebot 0.0.4 telegram-send 0.25 Telethon 1.23.0 Tempita 0.5.2 tenacity 9.0.0 tensorboard 2.18.0 tensorboard-data-server 0.7.2 tensorflow 2.18.0 tensorflow-intel 2.18.0 tensorflow-io-gcs-filesystem 0.31.0 termcolor 2.4.0 testpath 0.5.0 threadpoolctl 3.5.0 toml 0.10.2 tornado 6.3.3 tqdm 4.66.1 traitlets 5.13.0 trio 0.19.0 trio-websocket 0.9.2 typing-extensions 4.9.0 tzdata 2023.3 tzlocal 4.1 ujson 5.1.0 urllib3 1.26.6 validators 0.33.0 vboxapi 1.0 virtualenv 20.13.1 wcwidth 0.2.9 webdriver-manager 3.5.2 webencodings 0.5.1 websockets 9.1 werkzeug 3.0.3 wheel 0.43.0 wrapt 1.16.0 wsproto 1.0.0 yahooquery 2.3.7 yarg 0.1.9 yarl 1.7.2 yfinance 0.2.52 zipp 3.17.0

Thanks!

fsitios avatar Jan 22 '25 14:01 fsitios

I updated all python packages and fixed the issue.

fsitios avatar Jan 24 '25 15:01 fsitios

Closing this issue as the comprehensive input validation improvements in version 0.0.64 should address make_index scalar values issues. If you're still experiencing problems with the latest version, please create a new issue.

ranaroussi avatar Jul 18 '25 14:07 ranaroussi