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.10.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0057581b40a4b177a8f62c95644dc19ae9ecbb9d90933619d63118590e205ddf |
|
MD5 | fe9fd90fd42b6066604fa3af7838f7eb |
|
BLAKE2b-256 | 26c47c555c74981c213d7ee1d7fa09b71e92c83cd94fa4ba7d7090bfe2eb1c94 |
Hashes for pyodps-0.10.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b5ae1716b7f786e51f1ed45fb742e16c3ef038e2bb3f0be5590ec5c22ca5736 |
|
MD5 | 226546d4f5af7dc737daf2a90d3108fc |
|
BLAKE2b-256 | c55884beac93d5fcb533a889e51eedd740dfcb21055cb72a7450f300a6a77e0f |
Hashes for pyodps-0.10.2-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 | 3625c59a396a61639f0392dbc6f65021cec0eafc93b511a404302ae5b0e21708 |
|
MD5 | 879d8fae58f9bf78e98a558c6c857843 |
|
BLAKE2b-256 | 7eb86c726664f672d2f1f1d18e95c1656cd941912a4b083f5a781ad4942aaa18 |
Hashes for pyodps-0.10.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd6c43fa92deff9c412e7d4bf9fd1c340dbf1e0b758ad432a4d975b41ee71623 |
|
MD5 | 422239c52bcb634676f1751e7ffc402c |
|
BLAKE2b-256 | 1040843cf7724583acf7a6d53381e43bd49e70ac6c6ee903b22ac81385ee637d |
Hashes for pyodps-0.10.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8ef40419c87b96ce3074dbc847f834146ce1610a20ddf0f3900022509706812 |
|
MD5 | 5caa731428c68d805eacd924230d70ff |
|
BLAKE2b-256 | 5628bfe27a1abaef4f7fd04e6e57f0ea1e81f0a0312b7375d8fcc091ef5d12c5 |
Hashes for pyodps-0.10.2-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 | 83d70feeec6d13b384be75268edad2a4572da7e5d9d5dfc1ff1cea6c6d762f6a |
|
MD5 | 38e4c2bf60df125547ee1b42e6b0f26d |
|
BLAKE2b-256 | 9a8594229e36ef4f6a29e0569a7de80b2f65e7340efde51d37e2707534a22c15 |
Hashes for pyodps-0.10.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 322cda6bea18b6cc144b8edd8749c8346a565df245b16f0a7e86fed4a1795e5e |
|
MD5 | ac3e99b55a46f5e4f8d96487f715c0d0 |
|
BLAKE2b-256 | 091d1dd300613176d1f294e9bb3b919aff0d557b22bd6c218a09e92f95e4799a |
Hashes for pyodps-0.10.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc1e4e18c1760cbed0f12b33f24890d8d27af49a64c99f4222dbf77333069199 |
|
MD5 | f866d52887e44dbf0503b5dd3103c063 |
|
BLAKE2b-256 | a498f5fe4ef8c03d2649ae61415ba0e90736426f0963d240ce528dad1d5d99eb |
Hashes for pyodps-0.10.2-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 | a6dca89c327783626fba1610de3ed3abfa682ee6699a332ba1e4f62bbca1399e |
|
MD5 | 7b7f3cb5365224c48bff17c09697f803 |
|
BLAKE2b-256 | dc3256bf1ac2164002b5f5382cb13f388a4a8d26f811c2eae5c31db9bc427022 |
Hashes for pyodps-0.10.2-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25b8ff4e303b8bbb0af4f3f4172149b7e1ff8382fb1e8f75ff19b0bd73116aff |
|
MD5 | 0d7ce9a5a5475fac97fbeee586355842 |
|
BLAKE2b-256 | 6218a4b922d792b38fad52aaeeada17fc5827b3c25934aaffa2d9c83d57dabed |
Hashes for pyodps-0.10.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b579e2d2a7974918fa9a2ef360b13970b405a93e83b40b275d4ef4e3d403f8b8 |
|
MD5 | 536f66cf5fdb2d27ca6aea452c60a745 |
|
BLAKE2b-256 | f074fd89ade55cc6e0da0991d64b4d3451ebe9d97a526252d88bdfc927c2ac91 |
Hashes for pyodps-0.10.2-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 | 08ad85484658e3b47d253a46a5ccbd974a8c083994a09e4acd833a716e9186ba |
|
MD5 | 6aee59cadb45906b2a11d3bb4f43088e |
|
BLAKE2b-256 | a8efdd8dc8b6cb542708f2829d9fb40cfa6ea26361d34d7e80b24c34ff614ab0 |
Hashes for pyodps-0.10.2-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e376af94ce7dce53fd4de06906b1c90caaaac4c9fd143c98c7f5b5f37c3db364 |
|
MD5 | 4b17dd2bdd7100c88d63a75436dc04e4 |
|
BLAKE2b-256 | b45faa0b198752770b24baf5ce2d35f1f80dfd66968e28e82e4046b388006b3d |
Hashes for pyodps-0.10.2-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7262ee9bb683aad6f79ee1332f49745156c5dac74fde3d1a383ecc258d5ee57 |
|
MD5 | 1237ad22151d88ffba73399932303a22 |
|
BLAKE2b-256 | f62a55eb5f6eecf53863b2be06ac167f609aef6d231d193a3997bd2416275174 |
Hashes for pyodps-0.10.2-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f30bbfd18b82e57cabc30279e81a5985eff820bd2f20e8acc53d6402a5ee81b |
|
MD5 | bf42d1beecaa9d8872d884463b78b591 |
|
BLAKE2b-256 | d47fc586c38203d1234497962bf6e326d1243674beaa3ab47ad993190c9b6163 |
Hashes for pyodps-0.10.2-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 | aa9758cab8073e2c7b1488356420d58b9d215409649b3b912f34c6d998ad33ba |
|
MD5 | a43bd6c57e0cf2594050f6328b5556a7 |
|
BLAKE2b-256 | 92948f07f72fda97674bfee1a6693eb03a880b4ff42c0209cd0976feb5572d4e |