JerBouma / FinanceToolkit

Transparent and Efficient Financial Analysis
https://www.jeroenbouma.com/projects/financetoolkit
MIT License
2.96k stars 355 forks source link

pip install library and Syntax Error from the library [BUG] #102

Closed kurucan closed 10 months ago

kurucan commented 10 months ago

I have installed from pip, when I run the example code below and I get the error below:

3.10.12 (main, Jun 13 2023, 15:57:17) [GCC 8.3.0]

**

from financetoolkit import Toolkit

companies = Toolkit(b tickers=['GOOGL', 'MSFT', 'AMZN'], api_key="FINANCIAL_MODELING_PREP_KEY", )

SyntaxError: invalid syntax. Perhaps you forgot a comma? (3581324135.py, line 3)

** or the errow below:

TypeError Traceback (most recent call last) Input In [32], in <cell line: 1>() ----> 1 from financetoolkit import Toolkit 3 companies = Toolkit( 4 tickers=['GOOGL', 'MSFT', 'AMZN'], 5 api_key="FINANCIAL_MODELING_PREP_KEY", 6 )

File /opt/envs/venv-jupyterhub/lib/python3.8/site-packages/financetoolkit/init.py:4, in 1 """FinanceToolkit Initialization""" 3 # flake8: noqa ----> 4 from .toolkit_controller import Toolkit 6 print( 7 "Note: this version is purely meant to be compatible with Python 3.9 and Python 3.8 and will not " 8 "be updated. Please upgrade to Python 3.10 or higher and install the latest version of the Toolkit." 9 )

File /opt/envs/venv-jupyterhub/lib/python3.8/site-packages/financetoolkit/toolkit_controller.py:11, in 8 import pandas as pd 9 import requests ---> 11 from financetoolkit import helpers 12 from financetoolkit.fundamentals_model import ( 13 get_analyst_estimates as _get_analyst_estimates, 14 get_dividend_calendar as _get_dividend_calendar, (...) 21 get_revenue_segmentation as _get_revenue_segmentation, 22 ) 23 from financetoolkit.helpers import calculate_growth as _calculate_growth

File /opt/envs/venv-jupyterhub/lib/python3.8/site-packages/financetoolkit/helpers.py:130, in 125 statement_currencies = statement_currencies[statement_currencies.columns[-1]] 127 return statement_currencies, currencies --> 130 def combine_dataframes(dataset_dictionary: dict[str, pd.DataFrame]) -> pd.DataFrame: 131 """ 132 Combine the dataframes from different companies of the same financial statement, 133 e.g. the balance sheet statement, into a single dataframe. (...) 141 pd.DataFrame: A pandas DataFrame with the combined financial statements. 142 """ 143 combined_df = pd.concat(dict(dataset_dictionary), axis=0)

TypeError: 'type' object is not subscriptable

kurucan commented 10 months ago

python 3.10 fixed this error.