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.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 320fc8195d1bff7ce13df8d490c686b6a94bd66f7c5abd204e4d1b8cbe2680c8 |
|
MD5 | 89706235a34221592aac198760a79020 |
|
BLAKE2b-256 | fc88735c89f958716ee2a7a79f5b232fd42bb5782d9e3a6b641491f70b19a3bc |
Hashes for pyodps-0.10.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76ce531ee88b45e06fe1b564aadc6fc656df28ac6bfa2ce234d14c3a9a8d74f3 |
|
MD5 | 3a8e086939800a1edcf2eb57901ecdda |
|
BLAKE2b-256 | d2bb0afe0976052d52fd697bb8a95d230fc16ed7574470a95aa75e0c3a07be1a |
Hashes for pyodps-0.10.1-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 | 1c837299eb695ae8e49050ecdc689d37036d70faf912f6301f582aaa245e942f |
|
MD5 | 6b9c8dda85e8a126c0199f76862c1f72 |
|
BLAKE2b-256 | c46a74b5ac115e1bad6b58b19b7718815e891f5516bab18ec39554be374c5d7f |
Hashes for pyodps-0.10.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aa370ad753b5cdf258e052a7104ec71799b8706eb92b0d1941c5531dc24b154 |
|
MD5 | 23ed761ea7cc208052eff78541a70e60 |
|
BLAKE2b-256 | 7df5bf25aac1d020834281eda434c889012ea7fb3c2795e8bb409083ff888e25 |
Hashes for pyodps-0.10.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16678df3f154355068cc9faed0d1878736de77a643bed69ddc7c8cfa5cd90813 |
|
MD5 | c076781b8534c363269f08c6b97061b7 |
|
BLAKE2b-256 | fa5682f53eeab830c953b8b88ebb4310ae6dd8d07cfad1fb8e4e2faa10b489e7 |
Hashes for pyodps-0.10.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d71fa1390fcadee82a9e17cfb9143019232667c7683427123e3600a1191f119 |
|
MD5 | 588accf7ba948044fd6f8e954c1aecbd |
|
BLAKE2b-256 | d6c15edc1a283cfde28db0ff43bb900cef72c5a24b4230d052f9f1c13474c8f7 |
Hashes for pyodps-0.10.1-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 | 9fa26a7875906206488f1212490343c4106bbd7671b0adac5ee290ffb8118fd7 |
|
MD5 | fcd6b69aad20ecc10841908f39ebbfbd |
|
BLAKE2b-256 | 05569192509d85a06083279488515613d37091436fe1afc34a795a6442e35e21 |
Hashes for pyodps-0.10.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 224664699f9f3ea4d8c6a86c867537c8c194561267f3d32a94c7cf29e7981ca3 |
|
MD5 | 172ab2585d46c07a57d02514e55a90c7 |
|
BLAKE2b-256 | d4f88ab2c63b25cb496d645a249b315c0154342f208471c3ef52b67234e489aa |
Hashes for pyodps-0.10.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc7113b7f9d11fe4a26c83a13bf7adba5e8a8054bd9fa8946431dfdcd58a9a5e |
|
MD5 | 76eab77b9b3f7903fd045fc86f325f43 |
|
BLAKE2b-256 | 227136bd2164ec035a59e140470ea9055325099febbc009e2dbce01cee5d16ed |
Hashes for pyodps-0.10.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d92075fb28095a2d50aaf93336063f957b944e33cbfeee1fda983233857fc752 |
|
MD5 | 52fc1eee7a93e39025b99fb9ee80455c |
|
BLAKE2b-256 | a38e5098849768c2297f6c845241c2bf6cadc93ec9c13aedf4e368fd4fb6d44d |
Hashes for pyodps-0.10.1-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 | a90e123ea4a450f7f644ca95c4132af38f2c6953c9487335352bd1024bd65d59 |
|
MD5 | 0905849de1ca9cebccd9a0724e229d63 |
|
BLAKE2b-256 | 4d6ce1eb92f5a96ee3717ed0f6d3c5a16fe34ce316bfd292e63c2b2bb1b98b96 |
Hashes for pyodps-0.10.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95cf8aa16be43329ecf07ba25027d91f06a2e4ee6c89c935b6e21ca7e08b5860 |
|
MD5 | b0a28d07b8958910c68f1809b6c69512 |
|
BLAKE2b-256 | 7044fa945c69f98145e58eff3f5a9a87bba7bfa347e5c6a583ee0b26c8966019 |
Hashes for pyodps-0.10.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a14225903ab016c03bdb18e075bced44a1c248937ee68d63df9262510f881d8f |
|
MD5 | 11a0e7bce2076e713752aec822c03153 |
|
BLAKE2b-256 | 035ee43ea60ca7eb51a0f1bf5123d0ba558ab26726b79dae842936ce2eae0a8d |
Hashes for pyodps-0.10.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17ebb66faf04af40ae04cad1cd4579cb6b3bfd5f4815dae48959cd731358c4e5 |
|
MD5 | d3d8dcd6cfd3422c9d15289a84db9ae6 |
|
BLAKE2b-256 | f38456754f7a4d6f7b93523bdfa62f596a209c1c0a0447fc9b074c4c9f413fb7 |
Hashes for pyodps-0.10.1-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 | 54018fa6a8d0d73ed4eed42fc21c4906065e43099449d7d9fa6d658dca57839c |
|
MD5 | a2cb2503e5411786a3b0d40a029a0b15 |
|
BLAKE2b-256 | 39a384a639002150175cc26276d5ce90ced6f65a02a196a1b562f0f6ef73fced |
Hashes for pyodps-0.10.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 591501a76a191d7dace738c43c5243999d4f2effd951e1542fcdc4366f2388a0 |
|
MD5 | b3e0ce8d733cfb136a76d4fbf962cfbb |
|
BLAKE2b-256 | 188ace7d71d9b1b765c549c6a3da0aeb240386d0671eaee2c9478da03f3ac842 |
Hashes for pyodps-0.10.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73731fb7ea9e5aea4c459d1c15595066bc4281ae13546c8caded6d77199b535b |
|
MD5 | fe49b27c289a44481474fccbb9566389 |
|
BLAKE2b-256 | c023012df33446c59665e67228aa792c4927a9a26729a63a2c7d73ba69095dbb |
Hashes for pyodps-0.10.1-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f52f09f6027d0252b0592a170b717fef62786e0cc2a0c9e71c71710f5604e9a4 |
|
MD5 | e556ce4fd16237462a7c8e4ac3d8a04d |
|
BLAKE2b-256 | 954908e41fc0e4b21dc97f0ef1754bfc5f298234287236b1979fbd0efdde0f29 |
Hashes for pyodps-0.10.1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7a8215547bb7d3c0954fd9a1705c55adf12bec0101a9724bd84b576e6342ffb |
|
MD5 | 6b78238fc7f29942b39476b496a384c6 |
|
BLAKE2b-256 | 09b2e36c8f1db9778df38cb9c49f9acec4c7a936790845ddaccd68dd69b9f141 |
Hashes for pyodps-0.10.1-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 | 970528dfa8fc8ada61760f2c53beeddff37ee165ef36068fc0e24f715fa209cb |
|
MD5 | 8df56876a22adb38364cdd94322a880c |
|
BLAKE2b-256 | 9fde81fb5513b1590a3b3d9322cb230dc8ea00e26220f499de517ed0adb232bb |