ODPS Python SDK and data analysis framework
Project description
Elegent way to access ODPS API. Documentation
Installation
The quick way:
pip install pyodps[full]
To integrate with Mars:
pip install pyodps#egg=pyodps[mars]
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.10.7-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74473ec65440fc5bcdc66b55b13656bbdee86eec55a905d714150c3565d582de |
|
MD5 | bfb7fef0d400aa1a18a081169f919d03 |
|
BLAKE2b-256 | cddc1dced6bab0dc14eae06f25f6f22aba7f54c7b0e470b323273025e201da7c |
Hashes for pyodps-0.10.7-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d82a0905d085badc4058ae8ec0985475588b26879e133145f66d57131781e607 |
|
MD5 | a7945929b9f8c7d38e72d0f511e62ba7 |
|
BLAKE2b-256 | 5b50e854983dfdb423206403d64f4b1ffea03be80ccef4abce09257a372ac06d |
Hashes for pyodps-0.10.7-cp38-cp38-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b979a530350e2f81c937e67e759f0ffe62bd157827f7a45b38f04466ac654914 |
|
MD5 | d30f63012469d8ebe4503b4bdeaebe79 |
|
BLAKE2b-256 | 868da5ea5b6ec7d0ff9a7b16026183dbec850ce201414c2c218f40a033c8060c |
Hashes for pyodps-0.10.7-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fef7466447e280515cf2d03e4b9562fbb932c44a7def1618e31365f63bfd3ba2 |
|
MD5 | 64c8f780429bb9cbb40c04873beb10a0 |
|
BLAKE2b-256 | 16e158754b94af181514a4d74cbb5a066899e2d961c8020fd54f4cd5334cb7f4 |
Hashes for pyodps-0.10.7-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe603fd0d0d55e2377e77efa924a9c7f0701283f7797ad2ebbe7917c99b5dc67 |
|
MD5 | b1f5e8f9711db957e4545b0a5f8e4ba6 |
|
BLAKE2b-256 | d5d6437196ab5f5fba7249b0221a32cc29f11577b2d4a1064c9dcc5fdc8a68b0 |
Hashes for pyodps-0.10.7-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4b81489e58aa3275084868ffa0c318299f98cef4a1fb67f026837b6981375be |
|
MD5 | 619f276957e9b9196c3263329853fa38 |
|
BLAKE2b-256 | cf7753d50fb94951cecc7e399e6ff5349e2bc1646bfada6549502311af9b4751 |
Hashes for pyodps-0.10.7-cp37-cp37m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ba8d7f61b260e3910fac4507c5a764461d60af40d49fcc4a8278a76f33b2931 |
|
MD5 | fea07a8236c8d8871ebcaa103de714ef |
|
BLAKE2b-256 | d83659dac23dd3eccafb0c622bd678863657fada9bbc9ff86c3e2aea750b6884 |
Hashes for pyodps-0.10.7-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e21cb19d599ec8931a7fa7442d47a6433952b39c5107404b5b247e8a63f033aa |
|
MD5 | cbef90240260f44e944eb9f4c3d41ac7 |
|
BLAKE2b-256 | 11e3d058b2491d72077b278d58bbfd44021418a3d34853b7dd0e686092ae919b |
Hashes for pyodps-0.10.7-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 646adc67c108f16b7b304e7a7d1e8f8bc45db17c92e220f40dd973c3ddc5351d |
|
MD5 | b2245f8ca37845c01fc757269a4f8e36 |
|
BLAKE2b-256 | cc538b5e55b4a2d31c4196dcfe39ce2dd9d85df379215a03efaa53f53f7fb70c |
Hashes for pyodps-0.10.7-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec2481e7a67fc1c8635f57a31e2c87afaffdba0e73e6eaa213d577466213bba6 |
|
MD5 | 4360a9b0949e2d78706e478589412f61 |
|
BLAKE2b-256 | 0dd78ec0726f7610d264cfd41c7eb14601f08d864a80072d7c264afd332f816b |
Hashes for pyodps-0.10.7-cp36-cp36m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e018368f05044b566c6c836219e4a73d15dfd0999fc5a2060deb3c373526912b |
|
MD5 | cb874ff2ffb88c97fa7f600d14290f95 |
|
BLAKE2b-256 | 6738b432bd070c18533ce67efde2501a84fea5dd7b90dbc071cf37e743058fc5 |
Hashes for pyodps-0.10.7-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a07c56103ac1348c0e3599dd6728ba10d9b431aa81a759e872d5c60385f8c9a7 |
|
MD5 | 7ba96c79d82e8c22cf928a5d0079eea7 |
|
BLAKE2b-256 | 5db6928e1d7f8432d907031b3ccc67394fd6045d49e5e1c7ccbe12ed249e5fd3 |
Hashes for pyodps-0.10.7-cp35-cp35m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c779d15710f81df1bf9f46179d2b716f0782d332573b3ffa7ccf9ee255e61e8e |
|
MD5 | 7e062ee733329985c39b43039bbb18cd |
|
BLAKE2b-256 | 0b794069f7d4e69c83fc5929759a37112797cd8dc3581e9fa6663b7e87343bc3 |
Hashes for pyodps-0.10.7-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7251d1d489a530cfecf2edadb6a4a07f12ff77848043e0f153e24f691e0f0727 |
|
MD5 | 9c585a23247f56493ae85fead0cfb25f |
|
BLAKE2b-256 | a34ba1cfe8bd3706e644f2228532d2f9b0531c0b1fb50a7bc73aa634aae77b7c |
Hashes for pyodps-0.10.7-cp35-cp35m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2f2a41b52fa71c7a302d66af1ee748b97717619bec77163c837ad2ec4303560 |
|
MD5 | 601275ae76a6d157e6700e2d5d59465e |
|
BLAKE2b-256 | fa470a5460388ae68bfd45a7e06edf20923f76ec56361ee6db0f88440f1c8831 |
Hashes for pyodps-0.10.7-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 974a6f2cd6cfcff7905815c266b2bcece66c5ed5e9bb4950b4b44c93845c4fbc |
|
MD5 | ac2c0236b4ca497435dbecc331c67217 |
|
BLAKE2b-256 | cbf8095a96a5a4a662e5b2f53fa1f2c0984627fc4dd4b60801e1268bc89b9bdd |
Hashes for pyodps-0.10.7-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0264dd4ab5b23fcd747a1d51928830f43254746147b06a0aef827fd7239b6cc |
|
MD5 | de057f9fbabc9af7580dea84dc853aad |
|
BLAKE2b-256 | 697ec711e4e4f77a18a245d8fb1ab3043de687ebe1a708062be1fb1ff8c270fa |
Hashes for pyodps-0.10.7-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff39d3db84f4f50b1896b7a230f83338cee83b79aa43117f79c0edb41621a5d7 |
|
MD5 | ade780d60fba74f5232b27e4e0765ee0 |
|
BLAKE2b-256 | bc2ada9e326923d04ae9e924140338e7c082f1aa7fea5615856161260de6149b |
Hashes for pyodps-0.10.7-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 614d88945f5d8979800efcbd952923f7305c2ce58fe4adbded78ecf718aac1b6 |
|
MD5 | 3d5441b3ddf11654af3e5b6d6d794bd9 |
|
BLAKE2b-256 | 1534451635320405c1e527f6b9974f323b8c59b78d49e2a2e986b5f77f5393e2 |
Hashes for pyodps-0.10.7-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da8cc65d5a7ca2924e7a117d043ca231fe8a890295918a49993032a73d3722c3 |
|
MD5 | 96a0272277e18ecd8346cfc15b294a2b |
|
BLAKE2b-256 | 3cacf705d9011918749cea1a8d9d6b933efc3be4fc6f63ada20a331e876edd47 |
Hashes for pyodps-0.10.7-cp27-cp27m-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f73e641919d3217d7f0f34c92fdb55bcb86adac9d62705f01ce27cab3156ab40 |
|
MD5 | 54813391b5dadb491909a64115f8bfd4 |
|
BLAKE2b-256 | 6a84fa68ecaeaf72fbb8ac27c5d7593184f2675733caa717e573bd872a44ce05 |