Skip to content

yyuu/pandas-td

 
 

Repository files navigation

Pandas-TD

Build Status Code Health Coverage Status PyPI version

Pandas-TD

Install

You can install the releases from PyPI:

$ pip install pandas-td

For Mac OS X users, you can install Pandas and Jupyter as follows:

# Use Homebrew to install Python 3.x
$ brew install python3

# Install pandas, pandas-td, matplotlib, and ipython[notebook]
$ pip3 install -r https://raw.githubusercontent.com/treasure-data/pandas-td/master/contrib/jupyter/requirements.txt

# Set API key and start a session
$ export TD_API_KEY=...
$ ipython notebook

Examples

import os
import pandas_td as td

# Initialize connection
con = td.connect(apikey=os.environ['TD_API_KEY'], endpoint='https://api.treasuredata.com/')
engine = con.query_engine(database='sample_datasets', type='presto')

# Read Treasure Data query into a DataFrame.
df = td.read_td('select * from www_access', engine)

# Read Treasure Data table, sampling 5 percent of data, into a DataFrame.
df = td.read_td_table('nasdaq', engine, sample=0.05, limit=10000)

# Write a DataFrame to a Treasure Data table.
td.to_td(df, 'my_db.test_table', con, if_exists='replace', index=False)

Documentation

License

Apache Software License, Version 2.0

About

Pandas extension for Treasure Data

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%