29.03.2014 Views

Data structures for statistical computing in Python - SciPy Conferences

Data structures for statistical computing in Python - SciPy Conferences

Data structures for statistical computing in Python - SciPy Conferences

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

pandas <strong>Data</strong>Frame<br />

Basically a pythonic data.frame, but with automatic data alignment!<br />

Arithmetic operations align on row and column labels.<br />

>>> data = <strong>Data</strong>Frame.fromcsv(’data’, <strong>in</strong>dex_col=None)<br />

date item price volume<br />

0 2009-12-28 GOOG 622.9 1.698e+06<br />

1 2009-12-29 GOOG 619.4 1.425e+06<br />

2 2009-12-30 GOOG 622.7 1.466e+06<br />

3 2009-12-31 GOOG 620 1.22e+06<br />

4 2009-12-28 AAPL 211.6 2.3e+07<br />

5 2009-12-29 AAPL 209.1 1.587e+07<br />

6 2009-12-30 AAPL 211.6 1.47e+07<br />

7 2009-12-31 AAPL 210.7 1.257e+07<br />

>>> df[’<strong>in</strong>d’] = df[’item’] == ’GOOG’<br />

McK<strong>in</strong>ney () Statistical <strong>Data</strong> Structures <strong>in</strong> <strong>Python</strong> <strong>SciPy</strong> 2010 11 / 31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!