Questions tagged [petl]

petl is a general-purpose ETL package (extract, transform, load) for Python.

petl supports extracting data from XML, HTML, JSON, CSV and text files, databases, Excel, as well as Python objects, arrays, Pandas DataFrames, pickle files and other sources.

It offers various ways of transforming and combining extracted data.

38 questions
0
votes
1 answer

Calculating a value from a different column and a different row using PETL

I have a table that looks like this: +---------------+------+-----------+ | EffectiveDate | TSV | MTDReturn | +===============+======+===========+ | '1994-01-30' | 100 | 0.04 | +---------------+------+-----------+ | '1995-02-28' | None | …
user7496931
0
votes
0 answers

Find minimum value in a column of dates?

I have a column of dates, I'm trying to figure out what is the earliest date of the table and then insert a row above it with certain values. I'm using petl but can't seem to figure out how to use min on a column of date values. Is that even doable?
user7496931
0
votes
1 answer

Convert a value using a value from a different row with petl?

I have the following table: +---------+------------+----------------+ | IRR | Price List | Cambrdige Data | +=========+============+================+ | '1.56%' | '0' | '6/30/1989' | +---------+------------+----------------+ | '5.17%' |…
user7496931
0
votes
1 answer

What's wrong with this lambda function using petl?

I have the following table: +----------------+---------+------------+ | Cambridge Data | IRR | Price List | +================+=========+============+ | '3/31/1989' | '4.37%' | | +----------------+---------+------------+ |…
user7496931
0
votes
1 answer

Expand a column of quarterly months with petl and Python

I have a table with quarterly months: Effective Date 3/31/1981 6/30/1981 9/30/1981 12/31/1981 3/31/1982 6/30/1982 9/30/1982 12/31/1982 3/31/1983 6/30/1983 I'm trying to figure out how to expand these dates and insert the remaining months so that I…
user7496931
0
votes
2 answers

petl.todataframe() does not auto recognize data types

When I use petl to wrangle my data and then write it to a pandas DataFrame, I notice the wonderful ability of pandas to auto-recognize types goes away. Is there any way to use the features of petl while also preserving pandas's ability to auto…
Selah
  • 7,728
  • 9
  • 48
  • 60
0
votes
1 answer

pETL fails to load data to MySQL DB

I'm using petl package to build an ETL pipeline from Python 2.7 to MySQL5.6 My db connector is MySQLdb (mysql-python). The following code fails to execute: import MySQLdb as mdb import petl as etl con = mdb.connect(host = '127.0.0.1', user =…
Dimgold
  • 2,748
  • 5
  • 26
  • 49
0
votes
0 answers

Python Petl - _csv.Error: line contains NULL byte

I'm running this: table = petl.fromcsv('file.txt', delimiter = ',' , encoding = 'utf-8) petl.todb(table, connection, 'table') And i am getting this error on insert step: File "/usr/local/lib/python2.7/dist-packages/petl/util/base.py", line 28,…
gabriel.almeida
  • 125
  • 1
  • 2
  • 11
1 2
3