Skip to content

Commit

Permalink
Remove print and fix issue with str on sia/vis (#2034)
Browse files Browse the repository at this point in the history
* remove print and fix issue with str on sia/vis

* fix tests

Co-authored-by: Jeroen Bouma <jer.bouma@gmail.com>
  • Loading branch information
DidierRLopes and JerBouma authored Jul 4, 2022
1 parent 0517135 commit 3d3ee96
Show file tree
Hide file tree
Showing 20 changed files with 4,097 additions and 4,408 deletions.
9 changes: 7 additions & 2 deletions openbb_terminal/stocks/fundamental_analysis/dcf_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def create_dataframe(ticker: str, statement: str, period: str = "annual"):
The currency the financial statements are reported in
"""
if statement not in ["BS", "CF", "IS"]:
raise ValueError("statement variable must be 'BS','CF', or 'IS'")
raise ValueError("statement variable must be 'BS', 'CF' or 'IS'")
if period not in ["annual", "quarterly", "trailing"]:
raise ValueError(
"statement variable must be 'annual','quarterly', or 'trailing'"
Expand Down Expand Up @@ -431,7 +431,12 @@ def create_dataframe(ticker: str, statement: str, period: str = "annual"):
statement_currency = currency
break

df = df.set_index("Year")
if "Quarter Ended" in df.columns:
df = df.set_index("Quarter Ended")
elif "Quarter Ending" in df.columns:
df = df.set_index("Quarter Ending")
else:
df = df.set_index("Year")
df = df.loc[:, ~(df == "Upgrade").any()]

for ignore in ignores:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ def filter_stocks(
industry=industry,
exclude_exchanges=exclude_exchanges,
)
print(data.keys())
else: # no industry
data = fd.select_equities(
country=country,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ def change_type_dataframes(dataframe) -> pd.DataFrame:
dataframe : pd.DataFrame
Adjusted DataFrame
"""
dataframe = dataframe.apply(lambda x: x.str.replace(",", "").astype(float), axis=1)
dataframe = dataframe.apply(
lambda x: x.astype(str).str.replace(",", "").astype(float), axis=1
)

return dataframe

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
,2010,2011,2012
Item 1,10.0,1.0,10.0
Item 2,20.0,2000.0,
Item 2,20.0,2000.0,2.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
Year,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
Revenue,156508000000.0,170910000000.0,182795000000.0,233715000000.0,215639000000.0,229234000000.0,265595000000.0,260174000000.0,274515000000.0,365817000000.0
Cost of Revenue,87846000000.0,106606000000.0,112258000000.0,140089000000.0,131376000000.0,141048000000.0,163756000000.0,161782000000.0,169559000000.0,212981000000.0
Gross Profit,68662000000.0,64304000000.0,70537000000.0,93626000000.0,84263000000.0,88186000000.0,101839000000.0,98392000000.0,104956000000.0,152836000000.0
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
Year,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
Net Income,53000000.0,1500000000.0,2940000000.0,3688000000.0,10217000000.0,15934000000.0,22112000000.0,18485000000.0,29146000000.0,39370000000.0
Depreciation & Amortization,649000000.0,1011000000.0,1243000000.0,1945000000.0,2342000000.0,3025000000.0,4315000000.0,5741000000.0,6862000000.0,7967000000.0
Share-Based Compensation,1572000000.0,899000000.0,3639000000.0,4681000000.0,3218000000.0,3723000000.0,4152000000.0,4836000000.0,6536000000.0,9164000000.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
Year,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
Net Income,-396210000.0,-74010000.0,-294040000.0,-888660000.0,-674910000.0,-1962000000.0,-976000000.0,-862000000.0,721000000.0,5519000000.0
Depreciation & Amortization,28830000.0,106080000.0,231930000.0,422590000.0,947100000.0,1636000000.0,1901000000.0,2154000000.0,2322000000.0,2911000000.0
Share-Based Compensation,50150000.0,80740000.0,156500000.0,198000000.0,334230000.0,467000000.0,749000000.0,898000000.0,1734000000.0,2121000000.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
Year,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021
Net Income,16978000000.0,21863000000.0,22074000000.0,12193000000.0,20539000000.0,25489000000.0,16571000000.0,39240000000.0,44281000000.0,61271000000.0
Depreciation & Amortization,2967000000.0,3755000000.0,5212000000.0,5957000000.0,6622000000.0,8778000000.0,10261000000.0,11682000000.0,12796000000.0,11686000000.0
Share-Based Compensation,2151000000.0,2197000000.0,2446000000.0,2574000000.0,2668000000.0,3266000000.0,3940000000.0,4652000000.0,5289000000.0,6118000000.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
0,2012-09-30,2012-12-31,2013-03-31,2013-06-30,2013-09-30,2013-12-31,2014-03-31,2014-06-30,2014-09-30,2014-12-31,2015-03-31,2015-06-30,2015-09-30,2015-12-31,2016-03-31,2016-06-30,2016-09-30,2016-12-31,2017-03-31,2017-06-30,2017-09-30,2017-12-31,2018-03-31,2018-06-30,2018-09-30,2018-12-31,2019-03-31,2019-06-30,2019-09-30,2019-12-31,2020-03-31,2020-06-30,2020-09-30,2020-12-31,2021-03-31,2021-06-30,2021-09-30,2021-12-31
Revenue,1262000000.0,1585000000.0,1458000000.0,1813000000.0,2016000000.0,2586000000.0,2502000000.0,2910000000.0,3203000000.0,3851000000.0,3543000000.0,4042000000.0,4501000000.0,5841000000.0,5382000000.0,6436000000.0,7011000000.0,8809000000.0,8032000000.0,9321000000.0,10328000000.0,12972000000.0,11966000000.0,13231000000.0,13727000000.0,16914000000.0,15077000000.0,16886000000.0,17652000000.0,21082000000.0,17737000000.0,18687000000.0,21470000000.0,28072000000.0,26171000000.0,29077000000.0,29010000000.0,33671000000.0
Cost of Revenue,322000000.0,397000000.0,413000000.0,465000000.0,507000000.0,491000000.0,462000000.0,473000000.0,565000000.0,652000000.0,654000000.0,668000000.0,720000000.0,824000000.0,838000000.0,917000000.0,987000000.0,1047000000.0,1159000000.0,1237000000.0,1448000000.0,1611000000.0,1927000000.0,2214000000.0,2418000000.0,2796000000.0,2816000000.0,3307000000.0,3155000000.0,3491000000.0,3459000000.0,3829000000.0,4194000000.0,5210000000.0,5131000000.0,5399000000.0,5771000000.0,6348000000.0
Gross Profit,940000000.0,1188000000.0,1045000000.0,1348000000.0,1509000000.0,2095000000.0,2040000000.0,2437000000.0,2638000000.0,3199000000.0,2889000000.0,3374000000.0,3781000000.0,5017000000.0,4544000000.0,5519000000.0,6024000000.0,7762000000.0,6873000000.0,8084000000.0,8880000000.0,11361000000.0,10039000000.0,11017000000.0,11309000000.0,14118000000.0,12261000000.0,13579000000.0,14497000000.0,17591000000.0,14278000000.0,14858000000.0,17276000000.0,22862000000.0,21040000000.0,23678000000.0,23239000000.0,27323000000.0
"Selling, General & Admin",319000000.0,368000000.0,379000000.0,442000000.0,404000000.0,554000000.0,510000000.0,555000000.0,633000000.0,955000000.0,894000000.0,931000000.0,1051000000.0,1143000000.0,1191000000.0,1314000000.0,1365000000.0,1632000000.0,1712000000.0,1764000000.0,1706000000.0,2060000000.0,2352000000.0,2631000000.0,2871000000.0,3443000000.0,6084000000.0,5638000000.0,3764000000.0,4855000000.0,4370000000.0,4433000000.0,4473000000.0,4880000000.0,4465000000.0,5215000000.0,6500000000.0,7692000000.0
Research & Development,244000000.0,297000000.0,293000000.0,344000000.0,369000000.0,409000000.0,455000000.0,492000000.0,608000000.0,1111000000.0,1062000000.0,1170000000.0,1271000000.0,1314000000.0,1343000000.0,1471000000.0,1542000000.0,1563000000.0,1834000000.0,1919000000.0,2052000000.0,1949000000.0,2238000000.0,2523000000.0,2657000000.0,2855000000.0,2860000000.0,3315000000.0,3548000000.0,3878000000.0,4015000000.0,4462000000.0,4763000000.0,5207000000.0,5197000000.0,6096000000.0,6316000000.0,7046000000.0
Other Operating Expenses,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
Operating Income,377000000.0,523000000.0,373000000.0,562000000.0,736000000.0,1132000000.0,1075000000.0,1390000000.0,1397000000.0,1133000000.0,933000000.0,1273000000.0,1459000000.0,2560000000.0,2010000000.0,2734000000.0,3117000000.0,4567000000.0,3327000000.0,4401000000.0,5122000000.0,7352000000.0,5449000000.0,5863000000.0,5781000000.0,7820000000.0,3317000000.0,4626000000.0,7185000000.0,8858000000.0,5893000000.0,5963000000.0,8040000000.0,12775000000.0,11378000000.0,12367000000.0,10423000000.0,12585000000.0
Interest Expense / Income,11000000.0,-35000000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
Other Expense / Income,-6000000.0,53000000.0,20000000.0,17000000.0,10000000.0,2000000.0,0.0,4000000.0,61000000.0,19000000.0,1000000.0,0.0,27000000.0,3000000.0,-56000000.0,-20000000.0,-47000000.0,34000000.0,-81000000.0,-87000000.0,-114000000.0,-110000000.0,-161000000.0,-5000000.0,-131000000.0,-151000000.0,-165000000.0,-206000000.0,-144000000.0,-311000000.0,32000000.0,-168000000.0,-93000000.0,-280000000.0,-125000000.0,-146000000.0,-142000000.0,-118000000.0
Income Tax,431000000.0,441000000.0,134000000.0,212000000.0,301000000.0,607000000.0,433000000.0,595000000.0,530000000.0,413000000.0,420000000.0,554000000.0,536000000.0,996000000.0,328000000.0,471000000.0,537000000.0,964000000.0,344000000.0,594000000.0,529000000.0,3193000000.0,622000000.0,762000000.0,775000000.0,1089000000.0,1053000000.0,2216000000.0,1238000000.0,1820000000.0,959000000.0,953000000.0,287000000.0,1836000000.0,2006000000.0,2119000000.0,1371000000.0,2418000000.0
Net Income,-59000000.0,64000000.0,219000000.0,333000000.0,425000000.0,523000000.0,642000000.0,791000000.0,806000000.0,701000000.0,512000000.0,719000000.0,896000000.0,1561000000.0,1738000000.0,2283000000.0,2627000000.0,3569000000.0,3064000000.0,3894000000.0,4707000000.0,4269000000.0,4988000000.0,5106000000.0,5137000000.0,6882000000.0,2429000000.0,2616000000.0,6091000000.0,7349000000.0,4902000000.0,5178000000.0,7846000000.0,11219000000.0,9497000000.0,10394000000.0,9194000000.0,10285000000.0
Preferred Dividends,0.0,21000000.0,2000000.0,2000000.0,3000000.0,3000000.0,3000000.0,3000000.0,4000000.0,5000000.0,3000000.0,4000000.0,5000000.0,7000000.0,6000000.0,7000000.0,7000000.0,9000000.0,5000000.0,4000000.0,3000000.0,1000000.0,1000000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
Quarter Ended,2012-06-30,2012-09-30,2012-12-31,2013-03-31,2013-06-30,2013-09-30,2013-12-31,2014-03-31,2014-06-30,2014-09-30,2014-12-31,2015-03-31,2015-06-30,2015-09-30,2015-12-31,2016-03-31,2016-06-30,2016-09-30,2016-12-31,2017-03-31,2017-06-30,2017-09-30,2017-12-31,2018-03-31,2018-06-30,2018-09-30,2018-12-31,2019-03-31,2019-06-30,2019-09-30,2019-12-31,2020-03-31,2020-06-30,2020-09-30,2020-12-31,2021-03-31,2021-06-30,2021-09-30,2021-12-31,2022-03-31
Revenue,1184000000.0,1262000000.0,1585000000.0,1458000000.0,1813000000.0,2016000000.0,2586000000.0,2502000000.0,2910000000.0,3203000000.0,3851000000.0,3543000000.0,4042000000.0,4501000000.0,5841000000.0,5382000000.0,6436000000.0,7011000000.0,8809000000.0,8032000000.0,9321000000.0,10328000000.0,12972000000.0,11966000000.0,13231000000.0,13727000000.0,16914000000.0,15077000000.0,16886000000.0,17652000000.0,21082000000.0,17737000000.0,18687000000.0,21470000000.0,28072000000.0,26171000000.0,29077000000.0,29010000000.0,33671000000.0,27908000000.0
Cost of Revenue,367000000.0,322000000.0,397000000.0,413000000.0,465000000.0,507000000.0,491000000.0,462000000.0,473000000.0,565000000.0,652000000.0,654000000.0,668000000.0,720000000.0,824000000.0,838000000.0,917000000.0,987000000.0,1047000000.0,1159000000.0,1237000000.0,1448000000.0,1611000000.0,1927000000.0,2214000000.0,2418000000.0,2796000000.0,2816000000.0,3307000000.0,3155000000.0,3491000000.0,3459000000.0,3829000000.0,4194000000.0,5210000000.0,5131000000.0,5399000000.0,5771000000.0,6348000000.0,6005000000.0
Gross Profit,817000000.0,940000000.0,1188000000.0,1045000000.0,1348000000.0,1509000000.0,2095000000.0,2040000000.0,2437000000.0,2638000000.0,3199000000.0,2889000000.0,3374000000.0,3781000000.0,5017000000.0,4544000000.0,5519000000.0,6024000000.0,7762000000.0,6873000000.0,8084000000.0,8880000000.0,11361000000.0,10039000000.0,11017000000.0,11309000000.0,14118000000.0,12261000000.0,13579000000.0,14497000000.0,17591000000.0,14278000000.0,14858000000.0,17276000000.0,22862000000.0,21040000000.0,23678000000.0,23239000000.0,27323000000.0,21903000000.0
"Selling, General & Admin",855000000.0,319000000.0,368000000.0,379000000.0,442000000.0,404000000.0,554000000.0,510000000.0,555000000.0,633000000.0,955000000.0,894000000.0,931000000.0,1051000000.0,1143000000.0,1191000000.0,1314000000.0,1365000000.0,1632000000.0,1712000000.0,1764000000.0,1706000000.0,2060000000.0,2352000000.0,2631000000.0,2871000000.0,3443000000.0,6084000000.0,5638000000.0,3764000000.0,4855000000.0,4370000000.0,4433000000.0,4473000000.0,4880000000.0,4465000000.0,5215000000.0,6500000000.0,7692000000.0,5672000000.0
Research & Development,705000000.0,244000000.0,297000000.0,293000000.0,344000000.0,369000000.0,409000000.0,455000000.0,492000000.0,608000000.0,1111000000.0,1062000000.0,1170000000.0,1271000000.0,1314000000.0,1343000000.0,1471000000.0,1542000000.0,1563000000.0,1834000000.0,1919000000.0,2052000000.0,1949000000.0,2238000000.0,2523000000.0,2657000000.0,2855000000.0,2860000000.0,3315000000.0,3548000000.0,3878000000.0,4015000000.0,4462000000.0,4763000000.0,5207000000.0,5197000000.0,6096000000.0,6316000000.0,7046000000.0,7707000000.0
Other Operating Expenses,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
Operating Income,-743000000.0,377000000.0,523000000.0,373000000.0,562000000.0,736000000.0,1132000000.0,1075000000.0,1390000000.0,1397000000.0,1133000000.0,933000000.0,1273000000.0,1459000000.0,2560000000.0,2010000000.0,2734000000.0,3117000000.0,4567000000.0,3327000000.0,4401000000.0,5122000000.0,7352000000.0,5449000000.0,5863000000.0,5781000000.0,7820000000.0,3317000000.0,4626000000.0,7185000000.0,8858000000.0,5893000000.0,5963000000.0,8040000000.0,12775000000.0,11378000000.0,12367000000.0,10423000000.0,12585000000.0,8524000000.0
Interest Expense / Income,10000000.0,11000000.0,-35000000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
Other Expense / Income,12000000.0,-6000000.0,53000000.0,20000000.0,17000000.0,10000000.0,2000000.0,0.0,4000000.0,61000000.0,19000000.0,1000000.0,0.0,27000000.0,3000000.0,-56000000.0,-20000000.0,-47000000.0,34000000.0,-81000000.0,-87000000.0,-114000000.0,-110000000.0,-161000000.0,-5000000.0,-131000000.0,-151000000.0,-165000000.0,-206000000.0,-144000000.0,-311000000.0,32000000.0,-168000000.0,-93000000.0,-280000000.0,-125000000.0,-146000000.0,-142000000.0,-118000000.0,-384000000.0
Income Tax,-608000000.0,431000000.0,441000000.0,134000000.0,212000000.0,301000000.0,607000000.0,433000000.0,595000000.0,530000000.0,413000000.0,420000000.0,554000000.0,536000000.0,996000000.0,328000000.0,471000000.0,537000000.0,964000000.0,344000000.0,594000000.0,529000000.0,3193000000.0,622000000.0,762000000.0,775000000.0,1089000000.0,1053000000.0,2216000000.0,1238000000.0,1820000000.0,959000000.0,953000000.0,287000000.0,1836000000.0,2006000000.0,2119000000.0,1371000000.0,2418000000.0,1443000000.0
Net Income,-157000000.0,-59000000.0,64000000.0,219000000.0,333000000.0,425000000.0,523000000.0,642000000.0,791000000.0,806000000.0,701000000.0,512000000.0,719000000.0,896000000.0,1561000000.0,1738000000.0,2283000000.0,2627000000.0,3569000000.0,3064000000.0,3894000000.0,4707000000.0,4269000000.0,4988000000.0,5106000000.0,5137000000.0,6882000000.0,2429000000.0,2616000000.0,6091000000.0,7349000000.0,4902000000.0,5178000000.0,7846000000.0,11219000000.0,9497000000.0,10394000000.0,9194000000.0,10285000000.0,7465000000.0
Preferred Dividends,0.0,0.0,21000000.0,2000000.0,2000000.0,3000000.0,3000000.0,3000000.0,3000000.0,4000000.0,5000000.0,3000000.0,4000000.0,5000000.0,7000000.0,6000000.0,7000000.0,7000000.0,9000000.0,5000000.0,4000000.0,3000000.0,1000000.0,1000000.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
Loading

0 comments on commit 3d3ee96

Please sign in to comment.