luanborelli / ipeadatapy Goto Github PK
View Code? Open in Web Editor NEWipeadatapy is a data and metadata extraction package made in Python using Ipeadata database official API. In it's essence it is an API wrapper.
License: MIT License
ipeadatapy is a data and metadata extraction package made in Python using Ipeadata database official API. In it's essence it is an API wrapper.
License: MIT License
When installing the package with pip install ipeadatapy
, the requirements are not installed together.
Describe the solution you'd like
Create a setup.py
file in the root folder with the required packages listed in it (check this link for more info). With this, users would not need to run pip install -r requirements
after installing ipeadatapy.
Describe the bug
When using the timeseries.py function, the functionality supposed to group the returned values from the request (arg named "groupby") is not working properly, as the function named get_nivel_region() used within is not defined.
To Reproduce
big_theme = 'Regional'
theme_id = 6
keyword = 'Receita tributária - municipal'
name = ipea.list_series(keyword=keyword)['NAME'][0]
seriesCode = ipea.list_series(keyword=keyword)['CODE'][0]
myData = ipea.metadata(series=seriesCode, big_theme=big_theme, source=None, country=None, frequency=None, unit=None, measure=None, status=None, source_ext=None, source_url=None, last_update=None, code=None, comment=None, name=None, numerica=None, theme_id=theme_id)
if len(myData)==1:
myValues=ipea.timeseries(series=seriesCode, year=2017, grouby='TERNOME')
'''
Expected behaviour
I'm not sure how the groupby argument can group the results, perhaps it would create instances of the data frame, grouped by the grouping criteria ('TERNOME', territory name in this case).
Desktop (please complete the following information):
Describe the bug
When using the timeseries on COVID19 datasets, i've got error:
KeyError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2897 try:
-> 2898 return self._engine.get_loc(casted_key)
2899 except KeyError as err:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'RAW DATE'
The above exception was the direct cause of the following exception:
KeyError Traceback (most recent call last)
3 frames
/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2898 return self._engine.get_loc(casted_key)
2899 except KeyError as err:
-> 2900 raise KeyError(key) from err
2901
2902 if tolerance is not None:
KeyError: 'RAW DATE'
Desktop (please complete the following information):
Google Colab
OS: Windows10
Browser Google Chrome
Version 90.0.4430.93 (Versão oficial) 64 bits
Reported example:
idpy.metadata(big_theme="Social", code = "BPC_idos")
idpy.timeseries("BPC_idos", year=2017, month=8).to_csv("BPC.csv", sep=";")
Output:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-69-eb8760c3022a> in <module>
----> 1 idpy.timeseries("BPC_idos", year=2017, month=8).to_csv("BPC.csv", sep=";")
d:\code\abraji\testes\lib\site-packages\ipeadatapy\timeseries.py in timeseries(series, groupby, year, yearGreaterThan, yearSmallerThan, day, dayGreaterThan, daySmallerThan, month, monthGreaterThan, monthSmallerThan, code, date)
48 ts_df = api_call(api).rename(index=str, columns={"SERCODIGO": "CODE", "VALDATA": "DATE", "VALVALOR": "VALUE ("+list(metadata_old(series)['MEASURE'])[0]+")"})
49 else:
---> 50 ts_df = api_call(api)[['ANO','DIA','MES','SERCODIGO','VALDATA','VALVALOR']].rename(index=str, columns={"ANO": "YEAR", "DIA": "DAY", "MES": "MONTH", "SERCODIGO": "CODE", "VALDATA": "DATE", "VALVALOR": "VALUE ("+list(metadata_old(series)['MEASURE'])[0]+")"})
51 #api_call(api).rename(index=str, columns={"SERCODIGO": "CODIGO", "VALDATA": "DATA", "VALVALOR": "VALOR ("+list(metadata_old(series)['UNINOME'])[0]+")"})
52 if year is not None:
TypeError: can only concatenate str (not "NoneType") to str
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.