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.8.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c3e332f56a2766ebf259aaffa8aa64f3385b90abb1421b718fc2e8526f77f80 |
|
MD5 | 9f11a361478243acf8ac9f59793db675 |
|
BLAKE2b-256 | 459c8e5dd365b8aada4b5aa846a58d1c34bd3728130fa050edc1a51b3d555b3e |
Hashes for pyodps-0.8.5-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6437b218c2682511c59041518ec09e014400764c8ad45ee0819e015ffc209bdd |
|
MD5 | b477ee8a1ace421c7c64fd57ee11be44 |
|
BLAKE2b-256 | 061222758ab2ffa7b0808561b77500cc9d5811c8a17b66a516edf5d7af0c0a41 |
Hashes for pyodps-0.8.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4d7b16fc910e0f3c4e0269a46035b1e995a6989bd9063eda194f215d9b375bd |
|
MD5 | 9310672c31b7a3f81cbb587904212dee |
|
BLAKE2b-256 | 951f2c6b304fc142865a3451d72b4065a7c62ab8e71f9e20718ea0090dd52069 |
Hashes for pyodps-0.8.5-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccba81d6209133bb4aa9882f38009067fbcfcdbd43c8f27aa8b582a742551e52 |
|
MD5 | 9d16ee6be9d72548877e4457a6a01d42 |
|
BLAKE2b-256 | fdf2b27059c716f62bc345c161bcbaab4e96ce4e50c0199ba05cdcbe9355e56f |
Hashes for pyodps-0.8.5-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 | cfb610b8f3126e1355a186d640d6d24608ef85a9f27c3e0d2707a1b5e54cbbbf |
|
MD5 | 855acc44c20fc0f9ac17c7550afe9103 |
|
BLAKE2b-256 | 6038818baa3a060ce14f239367dd9dc0c8cc08ac296f03e4b82ca93be4335790 |
Hashes for pyodps-0.8.5-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3c370e4670eda2a48b06bc6f8d33413fe7958449bdded0848e6d68c08d3e1de |
|
MD5 | 7bbce1840e380cc563cabece1f0d3791 |
|
BLAKE2b-256 | d1ff0148ea5fcd980bf8f7d1b5f49ca21194689e8438a6af622ef51f9d028049 |
Hashes for pyodps-0.8.5-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4106b67a03c9bbb2b24e26f60a123f5190ad623bfe8650cef996ed5084111701 |
|
MD5 | a37febb6e98f22b76a7dcd2ae8614ae6 |
|
BLAKE2b-256 | 0e90a57443c55677b407ac0f7be8a375058feecb84b49e95611e8729727d95f6 |
Hashes for pyodps-0.8.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd0a5fe0f3aec04756187503de08fa7e26a2501fe32c64c063959c6c9b9917ed |
|
MD5 | 73b4d4b2133b7f254440a7b34ef01654 |
|
BLAKE2b-256 | a66a68b44ad2f62281e6de6bfaaa2919dc4220541ba9f800b26e23b6e42106dd |
Hashes for pyodps-0.8.5-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50d9bdab6f3d9b2fe2f4f278fa5f267a849ca58ff52be42f3b1f4ed7d5f0ba55 |
|
MD5 | 474b78ed3481b0c3b5f720dc6918f1f6 |
|
BLAKE2b-256 | 52478492806518110fc68ce8ce77c0aa3df157e1c3a9d1a690ed7863e2bac04e |
Hashes for pyodps-0.8.5-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 | 0596a6f5ab74e6faff9670e3e7595bf42055368746fd0e9bf237de07d2ebd814 |
|
MD5 | 9d572b819511d481ca9d353a4d0f781b |
|
BLAKE2b-256 | 198f8f1d8b11c05533e72bb58ea44f01a1407266dbab0744e0e9f618866af619 |
Hashes for pyodps-0.8.5-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 369c66b619256be480d1c87de0540b988bbcf8d13064768321c3d45342951450 |
|
MD5 | f2941074f6e3268026fee497f717a188 |
|
BLAKE2b-256 | ca52b19e3cdeb8e08edb1637a1e19a1ee870d82eb740ab10a3bd6d1f7920b673 |
Hashes for pyodps-0.8.5-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf343c8702ed05c30894e5d4d7d8fa010a5595654d54e27bfb4710090214013d |
|
MD5 | ede4de11ec57e14d87bcdeb18abf3216 |
|
BLAKE2b-256 | db57339bb688bfeb5bcd73a197103cf3364260b84f86b68b173a6b000f4e0d26 |
Hashes for pyodps-0.8.5-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36cac3fac27a901f8dfb0c7f28420f08cbca629933663c94280fb1bd2ff403ed |
|
MD5 | 445fb05f7dff922a739fede210321cf7 |
|
BLAKE2b-256 | 81c91f1f697a23e31064dc8d3b722f086bf46ac19993ca6c9d80daededcf6c54 |
Hashes for pyodps-0.8.5-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c6f9de2089b86297812b915a2fa4a6437f124e83f43ae02cc392366d68816cb |
|
MD5 | f1323f312b472a9c9bbfabdb38bdc5fd |
|
BLAKE2b-256 | 867c9a7c1e8e39dbec001f8debd5694dea4e171e098859e263ffc78515bb02af |
Hashes for pyodps-0.8.5-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 | 443b7b62e8665b16c5a24b0fc02823c4d15801348822c62bc0fd433c2935ced2 |
|
MD5 | d2cbe22b6f786cbaae141a9e248e604f |
|
BLAKE2b-256 | 6d1c2fd1d6837a3a77d47ceae114e92386bdbe9eb083182169b54e0f09ed1710 |
Hashes for pyodps-0.8.5-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 032196cf41aa8bbb171f0247470efe0f24cfeb7b35ce34665fccdf0f84f1fd4d |
|
MD5 | 8b24934bb09786ef35f6ca39657a192c |
|
BLAKE2b-256 | ccda497be20817e917a1d68df7b9baca6091761f0475a60a1ddfa25310a376b9 |
Hashes for pyodps-0.8.5-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67f03e4f6d6a7772b18c8f5b8a16e85530c726089afb892e3cbd82541ee0fa49 |
|
MD5 | be1cb7909c43299e3a3b979139c9364b |
|
BLAKE2b-256 | 766fb30057ac07dc6ff8c45029379fb95aa7b862b13c0e8bd83d54a5c1497820 |
Hashes for pyodps-0.8.5-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56b132a63450fcbdd272941d77dd2377f1c7961ccdc9b8e97efdd0f4e0ff0220 |
|
MD5 | 3daa70e667254804265fa9cb1b81b9a9 |
|
BLAKE2b-256 | fb9886c96e0100093d873b7287b91514a7f0a64f8c2668525d5ab883a62535de |
Hashes for pyodps-0.8.5-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 186ae4761547daac65ac1514b10fe143449425d246118effded97f751adccd5c |
|
MD5 | 7df4bce5375a46b37c406a6b9c2cb9c5 |
|
BLAKE2b-256 | 362be62cbe9e3c9002d43cbba95ce8ff0b4e5521b65d111ae18ff17af7017385 |
Hashes for pyodps-0.8.5-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60b6e8c8c2eae0053910850bbe47ba160d4e57bad1227f658443cd0799da80b8 |
|
MD5 | 7ce1b67c3eb93654f4b503c650239cfd |
|
BLAKE2b-256 | a62993640820311b58727b795cfb37e60f4ee125dc5a8c494deb1bd4f0d55cfa |
Hashes for pyodps-0.8.5-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5024ef9496782388e12340a064a64c0bcf4c148bc9282cd8c50b7665249128a9 |
|
MD5 | 2f98b57a1cefc6f528fa8ffc9d737521 |
|
BLAKE2b-256 | b59c8d664fe43add283e513a84a0fc8cb88b32409c29247d5950518a7e637deb |