一个使用britecore etl的python包。
brite_etl的Python项目详细描述
一个使用britecore etl的python包。
请注意:brite_etl跟在Semantic Versioning后面,目前正处于初始开发阶段(0.x.x)。小心使用。
使用
这些都在介绍页上被分解了。
importbrite_etlfrombrite_etl.core.io.frame_sourcesimportCsvSource# Create a "set" of frames to work with...contoso=brite_etl.lib.FrameSet('contoso')#Set the source of our csvs (can also pass BriteDataFrame/PreparedDataFrame)...contoso.set_data_sources(source=CsvSource(DF_ROOT),prepared_source=CsvSource(DF_PREP))# Easy handling of dataframes, works same for both csv and britedataframe sources.# Essentially a wrapper around the pandas DataFrame. Dates parsed automatically.contoso.frames.get('property_items')contoso.frames.get('agencies').df# original dataframe# Import BriteCore reports. Don't have to open/change/save columns in excel, hyperlinks and other# formatting issues are handled. Don't even have to rename the file to take out the dates.frombrite_etl.core.ioimportimport_reportadv_prem=import_report('/tmp/input','Advance Premium',sheet='Advance Premium List',skip_rows=2)# Pandas DataFramecontoso.frames.set('ap',df=adv_prem)# Make custom frames in your frame set# Define frame-specific operations...contoso.frames.get('prepared.lines').endOfMonthSum()# Or use universal operations, chain across multiple frames..._contoso=contoso.chain(_contoso.filter_dates('date filter for multiple frames actually isn\'t done yet (soon, though)').hash_cols(['policyId'])# MD5 hashed dataframes.export_excel(path='/tmp/output',file_name='end_month_integrity_hash.xlsx')# Every frame is put into it's own sheet during export.run())# Computations make use of multiple frames within a frame set (also chainable)...trans=_contoso.get_item_transactions().value()# Create multiple, isolated sets of frames...wrk=brite_etl.lib.FrameSet('working',from_set=contoso)
安装
pip install brite_etl
开发
要运行所有测试,请运行:
tox
使用tox -e py27或tox -e py35测试所需的python版本。比运行所有测试环境快得多。
关于测试的注意事项:有些测试需要实际的df_缓存数据才能运行。df_缓存目录的位置在setup.cfg文件中定义。运行时,测试将检查以确保目录存在并包含文件。如果他们不这样做,这些测试将被跳过,其余的测试应该正常工作。
更改日志
0.1.0(2016-10-03)
- 更新文档
- femove pypy env
- 使用语义版本控制
0.0.1(2016-10-02)
- pypi上的第一个版本。