Skip to content

Commit

Permalink
don't keep default na values while reading csv (fixed #346)
Browse files Browse the repository at this point in the history
  • Loading branch information
Álvaro Bartolomé committed Apr 15, 2021
1 parent 0e0db31 commit d4f2948
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 64 deletions.
10 changes: 5 additions & 5 deletions investpy/bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def get_bond_recent_data(bond, as_json=False, order='ascending', interval='Daily
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'bonds.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0064: bonds file not found or errored.")

Expand Down Expand Up @@ -466,7 +466,7 @@ def get_bond_historical_data(bond, from_date, to_date, as_json=False, order='asc
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'bonds.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0064: bonds file not found or errored.")

Expand Down Expand Up @@ -634,7 +634,7 @@ def get_bond_information(bond, as_json=False):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'bonds.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0064: bonds file not found or errored.")

Expand Down Expand Up @@ -789,7 +789,7 @@ def get_bonds_overview(country, as_json=False):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'bonds.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0064: bonds file not found or errored.")

Expand Down Expand Up @@ -908,7 +908,7 @@ def search_bonds(by, value):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'bonds.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0064: bonds file not found or errored.")

Expand Down
10 changes: 5 additions & 5 deletions investpy/certificates.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def get_certificate_recent_data(certificate, country, as_json=False, order='asce
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'certificates.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0096: certificates file not found or errored.")

Expand Down Expand Up @@ -494,7 +494,7 @@ def get_certificate_historical_data(certificate, country, from_date, to_date, as
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'certificates.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0096: certificates file not found or errored.")

Expand Down Expand Up @@ -674,7 +674,7 @@ def get_certificate_information(certificate, country, as_json=False):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'certificates.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0096: certificates file not found or errored.")

Expand Down Expand Up @@ -820,7 +820,7 @@ def get_certificates_overview(country, as_json=False, n_results=100):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'certificates.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0096: certificates file not found or errored.")

Expand Down Expand Up @@ -944,7 +944,7 @@ def search_certificates(by, value):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'certificates.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0096: certificates file not found or errored.")

Expand Down
10 changes: 5 additions & 5 deletions investpy/commodities.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def get_commodity_recent_data(commodity, country=None, as_json=False, order='asc
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'commodities.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0075: commodities file not found or errored.")

Expand Down Expand Up @@ -507,7 +507,7 @@ def get_commodity_historical_data(commodity, from_date, to_date, country=None, a
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'commodities.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0075: commodities file not found or errored.")

Expand Down Expand Up @@ -711,7 +711,7 @@ def get_commodity_information(commodity, country=None, as_json=False):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'commodities.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0075: commodities file not found or errored.")

Expand Down Expand Up @@ -874,7 +874,7 @@ def get_commodities_overview(group, as_json=False, n_results=100):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'commodities.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0075: commodities file not found or errored.")

Expand Down Expand Up @@ -991,7 +991,7 @@ def search_commodities(by, value):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'commodities.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0075: commodities file not found or errored.")

Expand Down
8 changes: 4 additions & 4 deletions investpy/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def get_crypto_recent_data(crypto, as_json=False, order='ascending', interval='D
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'cryptos.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0081: cryptos file not found or errored.")

Expand Down Expand Up @@ -446,7 +446,7 @@ def get_crypto_historical_data(crypto, from_date, to_date, as_json=False, order=
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'cryptos.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0081: cryptos file not found or errored.")

Expand Down Expand Up @@ -619,7 +619,7 @@ def get_crypto_information(crypto, as_json=False):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'cryptos.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0081: cryptos file not found or errored.")

Expand Down Expand Up @@ -907,7 +907,7 @@ def search_cryptos(by, value):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'cryptos.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0081: cryptos file not found or errored.")

Expand Down
8 changes: 4 additions & 4 deletions investpy/currency_crosses.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def get_currency_cross_recent_data(currency_cross, as_json=False, order='ascendi
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'currency_crosses.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
currency_crosses = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
currency_crosses = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0060: currency_crosses file not found or errored.")

Expand Down Expand Up @@ -499,7 +499,7 @@ def get_currency_cross_historical_data(currency_cross, from_date, to_date, as_js
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'currency_crosses.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
currency_crosses = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
currency_crosses = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0060: currency_crosses file not found or errored.")

Expand Down Expand Up @@ -666,7 +666,7 @@ def get_currency_cross_information(currency_cross, as_json=False):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'currency_crosses.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
currency_crosses = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
currency_crosses = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0060: currency_crosses file not found or errored.")

Expand Down Expand Up @@ -921,7 +921,7 @@ def search_currency_crosses(by, value):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'currency_crosses.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
currency_crosses = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
currency_crosses = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0060: currency_crosses file not found or errored.")

Expand Down
6 changes: 3 additions & 3 deletions investpy/data/bonds_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def bonds_as_df(country=None):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'bonds.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0064: bonds file not found or errored.")

Expand Down Expand Up @@ -106,7 +106,7 @@ def bonds_as_list(country=None):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'bonds.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0064: bonds file not found or errored.")

Expand Down Expand Up @@ -171,7 +171,7 @@ def bonds_as_dict(country=None, columns=None, as_json=False):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'bonds.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
bonds = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0064: bonds file not found or errored.")

Expand Down
6 changes: 3 additions & 3 deletions investpy/data/certificates_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def certificates_as_df(country=None):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'certificates.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0096: certificates file not found or errored.")

Expand Down Expand Up @@ -105,7 +105,7 @@ def certificates_as_list(country=None):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'certificates.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0096: certificates file not found or errored.")

Expand Down Expand Up @@ -174,7 +174,7 @@ def certificates_as_dict(country=None, columns=None, as_json=False):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'certificates.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
certificates = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0096: certificates file not found or errored.")

Expand Down
8 changes: 4 additions & 4 deletions investpy/data/commodities_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def commodities_as_df(group=None):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'commodities.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0075: commodities file not found or errored.")

Expand Down Expand Up @@ -106,7 +106,7 @@ def commodities_as_list(group=None):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'commodities.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0075: commodities file not found or errored.")

Expand Down Expand Up @@ -177,7 +177,7 @@ def commodities_as_dict(group=None, columns=None, as_json=False):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'commodities.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0075: commodities file not found or errored.")

Expand Down Expand Up @@ -233,7 +233,7 @@ def commodity_groups_list():
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'commodities.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
commodities = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0075: commodities file not found or errored.")

Expand Down
6 changes: 3 additions & 3 deletions investpy/data/crypto_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def cryptos_as_df():
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'cryptos.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0081: cryptos file not found or errored.")

Expand Down Expand Up @@ -82,7 +82,7 @@ def cryptos_as_list():
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'cryptos.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0081: cryptos file not found or errored.")

Expand Down Expand Up @@ -138,7 +138,7 @@ def cryptos_as_dict(columns=None, as_json=False):
resource_package = 'investpy'
resource_path = '/'.join(('resources', 'cryptos.csv'))
if pkg_resources.resource_exists(resource_package, resource_path):
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path))
cryptos = pd.read_csv(pkg_resources.resource_filename(resource_package, resource_path), keep_default_na=False)
else:
raise FileNotFoundError("ERR#0081: cryptos file not found or errored.")

Expand Down
Loading

0 comments on commit d4f2948

Please sign in to comment.