Skip to content

Commit

Permalink
fix build due to iloc error
Browse files Browse the repository at this point in the history
- .iloc error fixed since .loc was needed not .iloc
- country_code removed from etfs
- missing indices tests/ need to be included
  • Loading branch information
alvarob96 committed Oct 1, 2019
1 parent 51ae58f commit c375dc8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/funds.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ in order to make it more easy to use. Note that you can either select the value
# Get both name and country via pandas.DataFrame index
index = 0
name = search_result.iloc[index]['name']
country = search_result.iloc[index]['country']
name = search_result.loc[index, 'name']
country = search_result.loc[index, 'country']
# Get both name and country via unique field such as isin
isin = 'ES0113211835'
Expand Down
2 changes: 1 addition & 1 deletion investpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2482,7 +2482,7 @@ def search_etfs(by, value):
if len(search_result) == 0:
raise RuntimeError('ERR#0043: no results were found for the introduced ' + str(by) + '.')

search_result.drop(columns=['country_code', 'tag', 'id', 'matches'], inplace=True)
search_result.drop(columns=['tag', 'id', 'matches'], inplace=True)
search_result.reset_index(drop=True, inplace=True)

return search_result
Expand Down
4 changes: 2 additions & 2 deletions investpy/etfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ def etf_countries_as_list():

for index, row in markets.iterrows():
if row['country'] == 'uk':
markets.iloc[index, 'country'] = 'united kingdom'
markets.loc[index, 'country'] = 'united kingdom'
elif row['country'] == 'usa':
markets.iloc[index, 'country'] = 'united states'
markets.loc[index, 'country'] = 'united states'

return markets['country'].tolist()

Expand Down
4 changes: 2 additions & 2 deletions investpy/funds.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ def fund_countries_as_list():

for index, row in countries.iterrows():
if row['country'] == 'uk':
countries.iloc[index, 'country'] = 'united kingdom'
countries.loc[index, 'country'] = 'united kingdom'
elif row['country'] == 'usa':
countries.iloc[index, 'country'] = 'united states'
countries.loc[index, 'country'] = 'united states'

return countries['country'].tolist()

Expand Down
4 changes: 2 additions & 2 deletions investpy/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,9 @@ def index_countries_as_list():
else:
for index, row in countries.iterrows():
if row['country'] == 'uk':
countries.iloc[index, 'country'] = 'united kingdom'
countries.loc[index, 'country'] = 'united kingdom'
elif row['country'] == 'usa':
countries.iloc[index, 'country'] = 'united states'
countries.loc[index, 'country'] = 'united states'

return countries['country'].tolist()

Expand Down

0 comments on commit c375dc8

Please sign in to comment.