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.9.0.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 929925eaa51cc1cf1ad111dae22bd07ce4859faee986fc62420c5c91b37dcd80 |
|
MD5 | f7ae8218e63e31d33324372e8c1c491d |
|
BLAKE2b-256 | 2bf13651693323125976d0be10b0193ba681618ec807ade242894a0b27cdb64f |
Hashes for pyodps-0.9.0.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0685bdc1fc0b5302e9e49cb081bfeb56340abc1a397dc8daad261f65c4d584bb |
|
MD5 | 231fed8fe71888476cbc78ba08a961bc |
|
BLAKE2b-256 | eef667d929e63bcd9c8b03978051afac6fc05155345feb1d7892499a5c9aebe8 |
Hashes for pyodps-0.9.0.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 238940485980f3c96064b697d1bcd7c68af14360687e93f75c08043a97294295 |
|
MD5 | 00f5d297d36150341df85bd68fc8f08d |
|
BLAKE2b-256 | a1c0446eba2dd17a02912b42e961251b754429d095bf5fee88449eadc45175d5 |
Hashes for pyodps-0.9.0.1-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03b46bf468fac44099fe9b692bf053661330fc5b582e5542a9ae75d4725db968 |
|
MD5 | e624f129bff149b92d4f4dd349d06c8b |
|
BLAKE2b-256 | 6af2f0f419d3f685e3ee9532c1c34b27e132dce2f310ffb23a0f680d001625c4 |
Hashes for pyodps-0.9.0.1-cp37-cp37m-macosx_10_13_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 | d2133835455a68fddd845a42aaa5fba06c33e364fa77452db282a775c57939da |
|
MD5 | 0be9e4b36910853057146dd747f478f1 |
|
BLAKE2b-256 | 15b4e8e32522403472e0c1ea63e546c9b53380cc6dafe739f8e78befa6c5e515 |
Hashes for pyodps-0.9.0.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36987827cc941f402bf12b035aa2186ddfeadcb6bc50071dab155071bcdfd0d6 |
|
MD5 | c99779bca2a9b71a4f7c42b8116d5371 |
|
BLAKE2b-256 | 845b1cea88fe9aa631794085e3349fa48bb5cdc0e451b139a538f125c1df15c3 |
Hashes for pyodps-0.9.0.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c99814fea5159dba7c9e4d71b0950ee5b968f201a17e397a4a810f293c6af7ef |
|
MD5 | a0a7460cd97246613f9b6e8907cb7a1d |
|
BLAKE2b-256 | 6c888cb25bf5e92f46f1da89fef45a58cd6ed7b0f359b9d1804d3d79ebf45e74 |
Hashes for pyodps-0.9.0.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c635e8d48b9102eb31f849cd102237670560eedfd22a069913cb8af3a60ccb97 |
|
MD5 | 916c7ef2e8e0a2387cb474e277dcf9e8 |
|
BLAKE2b-256 | 0bdb5210059f316aca888e5f5d9e4a0e82c4d2e24f2c21d51502e7dd7c722a0d |
Hashes for pyodps-0.9.0.1-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9486b4c09494f48eb03a50fa1028d7529f91b2525c76a000bf30b06850052f9f |
|
MD5 | 0a9c223ca4c5e9ff5cebf8595b627b4a |
|
BLAKE2b-256 | fe380b5d8114f2fe6d7e50e5285b2bb3c04c6a262bb5340959312baf3eb0d6c3 |
Hashes for pyodps-0.9.0.1-cp36-cp36m-macosx_10_13_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 | 8038cb121300fae99fdbc1b9175b33ae8cfa50c879addd1678d9c2cefb3eea89 |
|
MD5 | 306bd391858e6cae9af54ccd7be0535d |
|
BLAKE2b-256 | 1b4d1f5728aeb6b648be10656c4069104bd50218047b3ae62e1fc7a361f6c229 |
Hashes for pyodps-0.9.0.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61d905e7fa1d223da209a73d3d42bac4ce4842b1a936a51e14d04d1c66454ba3 |
|
MD5 | d74d00650731dd6e035379add2425931 |
|
BLAKE2b-256 | 4721765757fd3fd4a53870269d6e67b673b59f14899cb95707bb98ccc49801d9 |
Hashes for pyodps-0.9.0.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b4f752e1a4b85551e6b206a1ebbd44dc97f82252f17f0aed39a383cf9bdfbe1 |
|
MD5 | 503d205e8ed9d36bd4e283c1c748c9c6 |
|
BLAKE2b-256 | e4bb196712657deb6ac91b90e12ebbda4141918b7fb040cb5ad6ec6df3e1c5d2 |
Hashes for pyodps-0.9.0.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc95b8a0749ef65d1316942b6eeb215e0bd557b7a7e7c66563aecc7b9ba19707 |
|
MD5 | 338430b799360013773e4d8ddce1d1ed |
|
BLAKE2b-256 | 3d7d0120f95f7875fd45d86442f02f18341f0966dd0689efb39002494b0e3964 |
Hashes for pyodps-0.9.0.1-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0024f79bd33e2f7d1dc29f83926d574b312b3eebb7f9fe6251e8da74e8152872 |
|
MD5 | 96592f32f315586290db291def123bfd |
|
BLAKE2b-256 | f5381de48947b28123ccb6c6ac680751d110a9d1f2ff87ab4425e517a7499692 |
Hashes for pyodps-0.9.0.1-cp35-cp35m-macosx_10_13_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 | b7b170c418d4a043dc59b20fc7c0626fbbef76dc914dfc07f392f4afbe2a43c3 |
|
MD5 | 464fb94c6f162c450552643923377ee4 |
|
BLAKE2b-256 | 04945639b28d021421405653560e40330f9cb127b9283995f2b085b493239368 |
Hashes for pyodps-0.9.0.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9591e0d3ac9529231e8e2efe4c45f21860961ff96cd6c93609dc7bdcb4bf748 |
|
MD5 | 4d5ebf43efab4ef5667d6ee5facb049e |
|
BLAKE2b-256 | b1a523f5f8f32428ea7258e3aa20f3ebe90604de63d4360a51e458d7faadb6b4 |
Hashes for pyodps-0.9.0.1-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03581cc764976d1a13f2622b4508eb112932c94337f89f46e23c44277b7807db |
|
MD5 | d82341eb2e6d5243917aa0d517120274 |
|
BLAKE2b-256 | 22da8435afe65945e0d21d47106ee9153b9263603d82505774dad7e456f1b644 |
Hashes for pyodps-0.9.0.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5605e6e74c3c276a6e0919ef294536c66f9787ed6bf428cb8bae54083ad74b5 |
|
MD5 | 3d96c6e59a47034d11bfaaa3b8993eb0 |
|
BLAKE2b-256 | 5a6614006f992ee3e57dcce514ccb087a4ce914fdd45ff5e15704a11e9655fde |
Hashes for pyodps-0.9.0.1-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37ef3c69245d29f1f086bb6eba034cf4a7ca5e7c7d163617f72ca52b2cf46079 |
|
MD5 | 2469a62d3612fca2410d391350a0a3e1 |
|
BLAKE2b-256 | 6658295770d99e0367da278c10f8669825f6b5db753190e393284297421043af |
Hashes for pyodps-0.9.0.1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a7ea6399be8a200b6fc81144766a445ef6e8e23d008206863a4060a6f1ee8a8 |
|
MD5 | c5be70ece60f31ef1195683fa0ff3dd4 |
|
BLAKE2b-256 | f099ce90ef88e8b48a82b85bd12f3a008a180200b857d7e3cc568279263d0f72 |
Hashes for pyodps-0.9.0.1-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be913e2e25865e7a4ee7a4090ff89b743dfefd76e012cf6b4398424be6a306db |
|
MD5 | dbb0983107dcb46f63483f070bc56777 |
|
BLAKE2b-256 | 41d9c8f800733f91b5430794cc8ae540a330b1497edcffb6742f3a1acea1d694 |