blaze / blaze/odo

Panel support for odo

Open
#268 3 comments 0 reactions 0 assignees View on GitHub
backend enhancement
Dominant language
Python
Stars
1k
Forks
131
PR merge metrics
No merged PRs in 30d

Description

`odo` doesn't seems to support Pandas Panel

Here is a basic example of what we can expect to be able to do with Panel and odo

You need to:

```
$ pip install pandas_datareader
```

And with IPython

```
import datetime
import pandas as pd
from pandas_datareader import data, wb

import blaze as bz
from blaze import odo

symbols = ['GOOG', 'AAPL', 'IBM', 'ORCL']
panel = data.DataReader(symbols, 'yahoo', datetime.datetime(2011, 1, 1), datetime.datetime(2015, 1, 1))
uri = 'dialect+driver://user:password@127.0.0.1:port/symbols'
odo(panel, uri)
```

`uri` is a database URI not a table URI

panel looks like

```

Dimensions: 6 (items) x 1006 (major_axis) x 4 (minor_axis)
Items axis: Open to Adj Close
Major_axis axis: 2011-01-03 00:00:00 to 2014-12-31 00:00:00
Minor_axis axis: AAPL to ORCL
```

You can get a DataFrame (a slice of Panel) from a Panel using

```
df = panel.loc[:,:,symbol]
```

see `p.loc[item_indexer,major_indexer,minor_indexer]`in http://pandas.pydata.org/pandas-docs/stable/indexing.html#different-choices-for-indexing

or using:

```
panel.to_frame()
```

symbol is "Minor_axis"

You can transpose using:

```
panel.transpose(2,1,0)
```

An additional parameter `axis` could be given to decide if table name are
- items
- major_axis
- minor_axis

A panel can also be create using

```
items = ['Open', 'High', 'Low', 'Close']
minor_axis = ['AAAA', 'BBBB', 'CCCC']
periods = 5
panel = pd.Panel(np.random.random((len(items), periods, len(minor_axis))), items=items,
major_axis=pd.date_range('1/1/2000', periods=periods),
minor_axis=minor_axis)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how odo handles pandas DataFrame inputs and database URIs, then compare that path with the provided Panel example. Define how Panel axes map to tables and how the requested axis option should work; done means the example can migrate a Panel and the chosen axis determines table naming.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.