Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError when requesting weekly interest rates #15

Closed
sametsoekel opened this issue Apr 30, 2024 · 3 comments · Fixed by #17
Closed

ValueError when requesting weekly interest rates #15

sametsoekel opened this issue Apr 30, 2024 · 3 comments · Fixed by #17

Comments

@sametsoekel
Copy link

sametsoekel commented Apr 30, 2024

Hi,

In 0.4.0 version I didn't encounter any problem while getting monthly and daily series but weeklies raise this ValueError:

>>> import tcmb
>>> clien = tcmb.Client(api_key = MY_API_KEY)
>>> clien.read('TP.KTFTUK')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\ProgramData\anaconda3\Lib\site-packages\tcmb\core.py", line 294, in read
    df = read(
         ^^^^^
  File "C:\ProgramData\anaconda3\Lib\site-packages\tcmb\core.py", line 159, in read
    data = utils.to_dataframe(res.json()["items"])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\Lib\site-packages\tcmb\utils.py", line 71, in to_dataframe
    df = df.astype(float)
         ^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\Lib\site-packages\pandas\core\generic.py", line 6324, in astype
    new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\Lib\site-packages\pandas\core\internals\managers.py", line 451, in astype
    return self.apply(
           ^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\Lib\site-packages\pandas\core\internals\managers.py", line 352, in apply
    applied = getattr(b, f)(**kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\Lib\site-packages\pandas\core\internals\blocks.py", line 511, in astype
    new_values = astype_array_safe(values, dtype, copy=copy, errors=errors)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\Lib\site-packages\pandas\core\dtypes\astype.py", line 242, in astype_array_safe
    new_values = astype_array(values, dtype, copy=copy)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\Lib\site-packages\pandas\core\dtypes\astype.py", line 187, in astype_array
    values = _astype_nansafe(values, dtype, copy=copy)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\Lib\site-packages\pandas\core\dtypes\astype.py", line 138, in _astype_nansafe
    return arr.astype(dtype, copy=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: '1970-1'

Thanks

@kaymal
Copy link
Owner

kaymal commented Apr 30, 2024

Hi @sametsoekel, thanks again for the feedback. The reason seems to be non-standard response attributes.

@sametsoekel
Copy link
Author

sametsoekel commented Apr 30, 2024

big thanks for this quick fixes ! when can u push the new release to pypi ?

@kaymal
Copy link
Owner

kaymal commented Apr 30, 2024

I've already pushed it. v0.4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants