ODPS Python SDK and data analysis framework
Project description
Elegent way to access ODPS API. Documentation
Installation
The quick way:
pip install 'pyodps[full]'
If you don’t need to use Jupyter, just type
pip install pyodps
The dependencies will be installed automatically.
Or from source code:
$ virtualenv pyodps_env
$ source pyodps_env/bin/activate
$ git clone <git clone URL> pyodps
$ cd pyodps
$ python setup.py install
Dependencies
Python (>=2.6), including Python 3+, pypy, Python 2.7 recommended
setuptools (>=3.0)
requests (>=2.4.0)
Run Unittest
copy conf/test.conf.template to odps/tests/test.conf, and fill it with your account
run python -m unittest discover
Usage
>>> from odps import ODPS
>>> o = ODPS('**your-access-id**', '**your-secret-access-key**',
... project='**your-project**', endpoint='**your-end-point**')
>>> dual = o.get_table('dual')
>>> dual.name
'dual'
>>> dual.schema
odps.Schema {
c_int_a bigint
c_int_b bigint
c_double_a double
c_double_b double
c_string_a string
c_string_b string
c_bool_a boolean
c_bool_b boolean
c_datetime_a datetime
c_datetime_b datetime
}
>>> dual.creation_time
datetime.datetime(2014, 6, 6, 13, 28, 24)
>>> dual.is_virtual_view
False
>>> dual.size
448
>>> dual.schema.columns
[<column c_int_a, type bigint>,
<column c_int_b, type bigint>,
<column c_double_a, type double>,
<column c_double_b, type double>,
<column c_string_a, type string>,
<column c_string_b, type string>,
<column c_bool_a, type boolean>,
<column c_bool_b, type boolean>,
<column c_datetime_a, type datetime>,
<column c_datetime_b, type datetime>]
DataFrame API
>>> from odps.df import DataFrame
>>> df = DataFrame(o.get_table('pyodps_iris'))
>>> df.dtypes
odps.Schema {
sepallength float64
sepalwidth float64
petallength float64
petalwidth float64
name string
}
>>> df.head(5)
|==========================================| 1 / 1 (100.00%) 0s
sepallength sepalwidth petallength petalwidth name
0 5.1 3.5 1.4 0.2 Iris-setosa
1 4.9 3.0 1.4 0.2 Iris-setosa
2 4.7 3.2 1.3 0.2 Iris-setosa
3 4.6 3.1 1.5 0.2 Iris-setosa
4 5.0 3.6 1.4 0.2 Iris-setosa
>>> df[df.sepalwidth > 3]['name', 'sepalwidth'].head(5)
|==========================================| 1 / 1 (100.00%) 12s
name sepalwidth
0 Iris-setosa 3.5
1 Iris-setosa 3.2
2 Iris-setosa 3.1
3 Iris-setosa 3.6
4 Iris-setosa 3.9
Command-line and IPython enhancement
In [1]: %load_ext odps In [2]: %enter Out[2]: <odps.inter.Room at 0x10fe0e450> In [3]: %sql select * from pyodps_iris limit 5 |==========================================| 1 / 1 (100.00%) 2s Out[3]: sepallength sepalwidth petallength petalwidth name 0 5.1 3.5 1.4 0.2 Iris-setosa 1 4.9 3.0 1.4 0.2 Iris-setosa 2 4.7 3.2 1.3 0.2 Iris-setosa 3 4.6 3.1 1.5 0.2 Iris-setosa 4 5.0 3.6 1.4 0.2 Iris-setosa
Python UDF Debugging Tool
#file: plus.py
from odps.udf import annotate
@annotate('bigint,bigint->bigint')
class Plus(object):
def evaluate(self, a, b):
return a + b
$ cat plus.input 1,1 3,2 $ pyou plus.Plus < plus.input 2 5
Contributing
For a development install, clone the repository and then install from source:
git clone https://github.com/aliyun/aliyun-odps-python-sdk cd pyodps pip install -r requirements.txt -e .
If you need to modify the frontend code, you need to install nodejs/npm. To build and install your frontend code, use
python setup.py build_js python setup.py install_js
License
Licensed under the Apache License 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pyodps-0.7.13-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36594231d21f1a1c30931ca02321614ead8a2423f45a25722bfb5c33c93166f8 |
|
MD5 | 23ba1b21cdaa7a05c6736d4759c8a253 |
|
BLAKE2b-256 | 7d0335c4c8244cd6b70d85a4fa77b1531979a396a49187d2140a92017fdb3b2d |
Hashes for pyodps-0.7.13-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b03ec86be8bd1751d5f59847e788d47ca47f55f0e674ced72aa463f9a084d42 |
|
MD5 | 9315344e8ec3c8f899f69e5b1fda2c31 |
|
BLAKE2b-256 | 49f2e3e52cd741c26ef8510ac3af9c301ec3e893ec9def7e8640950a4cc9e1b4 |
Hashes for pyodps-0.7.13-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a360b9f737b33417a6b175b9a0f70e7d23d939e89485ca9be5cccff9b2cf205c |
|
MD5 | 950c1a02d671ff44dae83cf13035d075 |
|
BLAKE2b-256 | 63b9700d9e2697cb8257d2558dc0bf2bb4c2375b03843ee6798fb398d5785918 |
Hashes for pyodps-0.7.13-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd34e9b10c02cf3d5fbae25c1d7bac898cbfc83e9bd36f371f9f2bcb975a62e8 |
|
MD5 | 6bea43a0c766eca5da12a250d88f9cdf |
|
BLAKE2b-256 | a1ff78570b185140728803c51f1e846e27d293c958d560897b541d82ab9c16f9 |
Hashes for pyodps-0.7.13-cp36-cp36m-macosx_10_12_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c61a6a20a06751e6d8f0525acc69ad2dc13c51b266f081c5c947d86fe3bca9d |
|
MD5 | 993514a740f17670f0dfa36de16b25a0 |
|
BLAKE2b-256 | f07e8e4daedcb00c9c5dfa69939f28ef0ff70cd414e7d74d63993e10d9982f12 |
Hashes for pyodps-0.7.13-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 087ccafcccfbf4a1795f93e2317558fcac470388ac63050bd07e02fa3982c287 |
|
MD5 | 415c88e56866426b948c79bc0a2ebb5f |
|
BLAKE2b-256 | f7e5db6060fc32e78eefef60837aaef750ee8ce82b219956e869bd768967cf38 |
Hashes for pyodps-0.7.13-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c49bbc2ca06ebb781f6b0bacd1890190110f973cf83af3dbefb26d62dde2ff9 |
|
MD5 | 914b0caedf57c73b5be0bc8fce2d3b9c |
|
BLAKE2b-256 | e7fb426dc05eb7e1937d10832a8e93da03a3e3c33445ef8871a1b5bd7b2cb190 |
Hashes for pyodps-0.7.13-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fecdccb0613d1c402a89b1797540df12ff8ac91e57880cb8260d3ab269edf274 |
|
MD5 | 8a82dfd6894ba0aeaaaf290636fe943e |
|
BLAKE2b-256 | 380538aef3c9a4dec9107c9f45da38cf0102b4ea7f00bb877465aee0eaf060d3 |
Hashes for pyodps-0.7.13-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1921960f754e6d5f6f49be516832a428284fbb72d3bb2079f454d125dfa41d89 |
|
MD5 | fac6f3699cb40b9eb3d620a2a23f9b23 |
|
BLAKE2b-256 | a441faafb94699e572a08397f15c6336fa740c0b60b20a74b7a5df1f8ca849bf |
Hashes for pyodps-0.7.13-cp35-cp35m-macosx_10_12_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95f1362f0d0326d486f2a2f1fbd02afea62008165f0c4b118dece1fd22acf296 |
|
MD5 | 2807148c9c3a835314a5c0ca26356799 |
|
BLAKE2b-256 | 49bf6e8c6e36e52837553a766e7b78360aa8f932b39e0fb5995e1067afcc55af |
Hashes for pyodps-0.7.13-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ef079b233410ea520e15a74ff310bbd8cf1d9ec0848e0f6071973e09e0364ad |
|
MD5 | 98534e6c9031955845e30185a8a61bab |
|
BLAKE2b-256 | c9183a0e58ec8a43747ae11cdd85184d8209e582537bcae80c584a9bc87dac44 |
Hashes for pyodps-0.7.13-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48b0a47ed5398a10ec7b480be057fead8eb7e7b7d913d7de6ff266d0e87cc2b0 |
|
MD5 | cfd283946ebb0d1b33354648c3d7aed5 |
|
BLAKE2b-256 | bbd0d6ce4905516442a3b49726d507a7f24d15fccfc16a540a86ac5f97c95c05 |
Hashes for pyodps-0.7.13-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50eae5ddeb0d2eeb0cd0295011dcc1c5f87b847ce6fc0479c04c0c8a170b377d |
|
MD5 | c9af8a521e4ac12f0dc58f4056667091 |
|
BLAKE2b-256 | 158b250e43c385ed4f8f8819e040161a9b70a79d7404bbfe37e0e18f27469c1e |
Hashes for pyodps-0.7.13-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b045631ad47c3b10d20f86fc05bdd3de7dc85504a001c348ebac9fb2d5637486 |
|
MD5 | e1227f3f21c81ba1e41c221cea5c5618 |
|
BLAKE2b-256 | 4b5e76d2bbbd344f3cd53335be3a7f61f39bcab238f117cdaa4b15db0fc63ace |
Hashes for pyodps-0.7.13-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 940814ed5bd8c08b64270d2321c1182b7af9b48bca22f9b42b64c34d74a3a36a |
|
MD5 | 5dd05a05b7f8bba871a3aac9bebc7084 |
|
BLAKE2b-256 | c527aec428a65208c9dec2934c0212a3c0a7972248469c17817cc742457ac086 |
Hashes for pyodps-0.7.13-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81847de50551ed18be894aa3044833d3fbfae6ef59e8e5b046a2069d21c57a8f |
|
MD5 | 6877cafa51ea24d6b24049da6f00968b |
|
BLAKE2b-256 | 64a41ba2c7151511f17fa0bd978fb5a89f464f2e8ee2e05a8945b89326ac85f4 |
Hashes for pyodps-0.7.13-cp27-cp27m-macosx_10_12_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3775c4795711add0cd036ad7fb7d9f6343eca731d7b06bb717b4ca78efd85e40 |
|
MD5 | 2504a6fb24f4963336eae4f66deffd2d |
|
BLAKE2b-256 | adee8851e0caa9712cab3b69dc81d87dbb1cf815ee1a039953dbf056348cb2ed |