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.11-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1849a350b0b56b3e6bdc71b0582995a1d0e104db17ba9dcf4dfe2203cbfdb8b9 |
|
MD5 | 9b493b6983885a27d42e62daa0fabe7e |
|
BLAKE2b-256 | c340335eacf5a977862bc0c9a1fc44a64be22c072c6552872285a46d4d461a41 |
Hashes for pyodps-0.7.11-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f441a3f6996ca80ded6471b467214a156b891c3a4b7fcf0e285fce1ed0c4fa03 |
|
MD5 | 85382dd56795b2ba0bf07865fe7b7691 |
|
BLAKE2b-256 | 7a3fbfeef7c8c3539c7c910787e5b9b0c98f89eb8084bf7914d21b1a1d8a657f |
Hashes for pyodps-0.7.11-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 577f2e1763e086279e20984acf73957887048417b1dbd9b3ba3c8430566b9768 |
|
MD5 | 4a34a8ee387ff91f476d4d7bdea2d7cc |
|
BLAKE2b-256 | 592d94850ea33ed97925b7b9e769f08ae5609fcc5ebbf612103266bca6dba1c1 |
Hashes for pyodps-0.7.11-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 206eab535fa23e0639df39f63715fad7dc5031f6100752fe8d0ffb01c2db29ac |
|
MD5 | e7522e1d9cea8b78d201c292aada500d |
|
BLAKE2b-256 | d66658b9f223a5d8e5cc3e225fcd391c919cb8dc8dc24f65c0cc38c51197348e |
Hashes for pyodps-0.7.11-cp36-cp36m-macosx_10_11_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 | 45511ba9b48f87b88171d7173aaf5ae58d6141c12ff7966f047dc0774049a366 |
|
MD5 | 108b95441327c7b8527b0e24b65c37f3 |
|
BLAKE2b-256 | 8949caf63ed60b006207b8d4096ce46fdc3d56248a3db4c1428e45a9ff725fec |
Hashes for pyodps-0.7.11-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee29af0081c9b48b10051b2a514af501e00443dd0dab695ea711c51b9ddce51f |
|
MD5 | 9f3efdd44acc50fb92350f695eb8251b |
|
BLAKE2b-256 | be840faff9127a48c49fedcd91dd6c3c4179f17a7beaafc1905a0bbbe0b2676d |
Hashes for pyodps-0.7.11-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 173292c4edcd61848a402b98fc09a207f27916f6eba7b21811189d1ee41e935a |
|
MD5 | 27d724e5f0de03c5420fbbe4dc21183e |
|
BLAKE2b-256 | 190f7bcb5f7c2011736f45473854f0cd62f2e49e8c2074a11bcfa4ac6f490847 |
Hashes for pyodps-0.7.11-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f8b7a45ed7967043ee722a509cb9dfa492c507c43b30425fc211aacafcb209c |
|
MD5 | 8c48a8d6de01d0ea83f09b47e50e542f |
|
BLAKE2b-256 | 74cc27e35ef0548250cb34397e7bfa6cb12552b6b74873eb42a7b52f50a8f9fc |
Hashes for pyodps-0.7.11-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44b8cb7756fe1086dd4889552c2cd59e1f7a0a9e2f2d7a395d51f4ab2b17a093 |
|
MD5 | 63a38b10b345769f6014d66afa2ac7e1 |
|
BLAKE2b-256 | b17461201cf636c97637918e6bf1f63891debd8f52e99a43f90d6b4692790460 |
Hashes for pyodps-0.7.11-cp35-cp35m-macosx_10_11_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 | 93551749319c12185bc0a6ff86f681e0d6935e0dfe4ddc5ebcdd34456c25f55e |
|
MD5 | daca2d8f7c8865a05c721c8cb876c1b0 |
|
BLAKE2b-256 | 5a561192b4a800ab074a702d47f28ead799abdd97e25de8e19d4386542a362fd |
Hashes for pyodps-0.7.11-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e855eb27a9f357bdd25e65c86b0b2b0036c134b17ec8fa49f0335195f3b70fff |
|
MD5 | bf4bf9c0f152afb2124e3e5bbf2c2379 |
|
BLAKE2b-256 | 7f125b8043ee7a97183e76c241320f2ecd7d7a2038ef004bfd260a643d4ba2f1 |
Hashes for pyodps-0.7.11-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 050a1e0c5d2cf781325b7a1efd12bf5461d1055bf2300da229cac41ff17186ce |
|
MD5 | 5798839dc3509bf3191c1ab5ae81738f |
|
BLAKE2b-256 | 50660b88a6b9481a8add9f5dfcbb5cb5d584befa4083b6cd24ffe683409e8afe |
Hashes for pyodps-0.7.11-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1828e69bb2a24fdb72fca21beb1a66300112b491def65dc7cc1d83d746909480 |
|
MD5 | ca5be86daaa94797b5eaaa989e825100 |
|
BLAKE2b-256 | acf8c7887a16545e47ad5b39a6fe1440fb287c7f178be602414e48e6fb1b29e4 |
Hashes for pyodps-0.7.11-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 454919d470d534398d6d562964a561070fea82ad3aa3025c8d4064e33a57d1cc |
|
MD5 | 51409019db543722eb91eb793ab0aff1 |
|
BLAKE2b-256 | 0f576787d18d6702f7bab19684d0f656bc7730643dbdaf067a97b14d812e16f4 |
Hashes for pyodps-0.7.11-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 371756ac68edd17fdab3ccf70921bb682e0a93041b5e9ffa53af6a9fea6cde86 |
|
MD5 | 9396af93e5c57d422480dedb718f1513 |
|
BLAKE2b-256 | d59079116df23ccb48e0efe97f6654118a7dede77875e08ad13b1e8a71cb70e5 |
Hashes for pyodps-0.7.11-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f97405a03ce4e17009e95b2a89ca855b82232d290c1de90969ed22acd515187e |
|
MD5 | 127970d2d78afb4e8d4c58c183cba032 |
|
BLAKE2b-256 | 6a34409cb48745cab92e01b3759d8a0a0c1fc0ff1dc5b72c63ae4c4455b4ec69 |
Hashes for pyodps-0.7.11-cp27-cp27m-macosx_10_11_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 | 814206b2ede115665175d3e0ac8734c1da09061e969bb3b3e9a68147174a299a |
|
MD5 | c657be9edeeb0db429aedc1dc3a9ea83 |
|
BLAKE2b-256 | ec294998590db7bd5edafeae74334c95df9c2be5b40868452bd99a8ac4f6563b |