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.3.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf8a7ea874abbca15a79f3d5e399c3676e11decfae479f8d25d6d584828cced2 |
|
MD5 | 050eae4675b5b43ede956816b2c326fd |
|
BLAKE2b-256 | 14ec3993a8e82ee6abceb47bee2a42b1a95ca54e02bf16b4d89e7a1e7900637c |
Hashes for pyodps-0.9.3.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e2a04e8caa59dd4b16f7d73bb1a5faca1434992338327fd1450f4f8070d9c0c |
|
MD5 | 6fc657821f909edda1137c95ee07e184 |
|
BLAKE2b-256 | e32292831dceaeb376503bad45c500502e84e7861adde956cf7fb44477dd828f |
Hashes for pyodps-0.9.3.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0aa591412260317017881386aa3367a39b9c38a5b04155216a8ab1a6fdeed9b |
|
MD5 | 1e41a9cfce6285585719103335c394bb |
|
BLAKE2b-256 | c178b214ad0a40b4bae9e50563f89928d46a737c35128ec6822f85809a485489 |
Hashes for pyodps-0.9.3.1-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47540f902e58ae8e1ec6e8b914761d02a0e125768648e728dcf87fd853c97271 |
|
MD5 | 29d1627afab5de3c60663156e157b754 |
|
BLAKE2b-256 | 74501e57775a3498fb54d1153cb97f29478564000990f8afa0f29fd56b9b5aaa |
Hashes for pyodps-0.9.3.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 | 0fab8222238cc6d923487650cedb0222287a660caecd1110de5f566d3d163392 |
|
MD5 | cace97100cd94ecf83f062803c4ddd0b |
|
BLAKE2b-256 | 5cb801be160ba3699c4f3e5a19a52c3ba1520ae60d41aac528326c111ce47422 |
Hashes for pyodps-0.9.3.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edbefdc17daf253ee018f8b9e1bed020c2e122d505379d07e5cceab322063ae3 |
|
MD5 | 2f6c2f691808c8da8e7786ce08c81f83 |
|
BLAKE2b-256 | 59fdac33488092549b43e736cff246bdcc48e51c2becf092730c435ca7916f31 |
Hashes for pyodps-0.9.3.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c22ac9610d31f2c08cfbc57b92f43b7107eccb23470f8482cacfb4cbe8a0cf52 |
|
MD5 | d79ea5b1c1d7198e81b8f8856b92832b |
|
BLAKE2b-256 | acb6eaaec30c9cffbcdeb667bfeb9a31510afbe87964eb2c2bef023274dad82d |
Hashes for pyodps-0.9.3.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f90280f091ff1c500c9f61c5dcba24b13605e1c0bc5026913e58efba293124d |
|
MD5 | 9d038326ee8c5b16e2abaa0744c1fe01 |
|
BLAKE2b-256 | 2bfd0f0a19cc731c499b9bdcb9409c02b2426c10ccd91eaf7367b4bbe72c2b9d |
Hashes for pyodps-0.9.3.1-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb48565fb1517eba4d2d363f8ddd472031409c5f42536152bcf55ea92324c152 |
|
MD5 | c680e768012239c8b802911f5de43c3e |
|
BLAKE2b-256 | 8e2c643d1a0d7e8df9d42138157bdb7f3224587610e6ccd5ec22316e0bd0baf6 |
Hashes for pyodps-0.9.3.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 | eb611d3690c08433b20dc7b55fefa74741839e1c15536be1db53c9a0ea871c90 |
|
MD5 | 5197898c777a7077d4bf29f6c11b0508 |
|
BLAKE2b-256 | c30d617f85aa2de7a2973449810c49cdfd4077b782e075b7f7bd0d2c7181dd8a |
Hashes for pyodps-0.9.3.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b31ef483a85486ddf3083d7620736c53ad9d48dc932aacb766bc947c007bac58 |
|
MD5 | 132f712d1096877d0cb6104fffb34025 |
|
BLAKE2b-256 | f802ecae63d80842f4ee86910d8ec315740dd86754fe945ec70a21b8060c212d |
Hashes for pyodps-0.9.3.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42d5b0480573f0ec2045e3b557e50d0ef8ed6ac7aaedd154e18f77ab384fa167 |
|
MD5 | 626ebea21e0f64b057b10b6adb773c1f |
|
BLAKE2b-256 | 476fcd9ca286c284e71075fee0075e463265af68ee07d96667440eb4b5d05c87 |
Hashes for pyodps-0.9.3.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96d9d86055abfac7330710c3051bd2be2d2e18323178002832386f603d82005e |
|
MD5 | b199254b5d41fad36782123caa2c21f2 |
|
BLAKE2b-256 | 0c0b37e513f13921e0cb4d17bd0dfbdcf9aba0292600230b9322c64f97a5765f |
Hashes for pyodps-0.9.3.1-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 240ca0ee25ef5df7a173c581cc4ec68e098146801d973eb8d7b53b8a4ad1b09d |
|
MD5 | 376d4626c944de6469f84d095c460168 |
|
BLAKE2b-256 | 0a919e0d2180d6667d3cdb1739810ec95d0d38f1573c1ad850af4b0ff73e929c |
Hashes for pyodps-0.9.3.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 | 4bc25d7c8b7707dd517d9ea9a24d7e0807d61cc58cc66125560089350fa013f0 |
|
MD5 | ee4cd4911788a7cfae48095e61cb509e |
|
BLAKE2b-256 | 00305c00de7ff3af9deaa903709b44f725d149bfb5bd7d216aee87655c3ff035 |
Hashes for pyodps-0.9.3.1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b80fe187c088439e909f293065a89fbda8453711f10fe5fd62cf5ce629612cb1 |
|
MD5 | 197d3311ee621dbd94f8a138c6e9e27f |
|
BLAKE2b-256 | afa452e1f0c059a5c14025baa12bf290f285f91771c11ea79ad2d028c6976efa |
Hashes for pyodps-0.9.3.1-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebf53bcfbe42c00a5aec637023f31a1dbdccb6694c67e3005b1ec0ecda84e5fe |
|
MD5 | 62c41b52cbc903caf7593dce7c8956c5 |
|
BLAKE2b-256 | 7bcc60c585667251455600a844b0e86cda405aee1e7c838c2eb84ea270d60595 |
Hashes for pyodps-0.9.3.1-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 216231a27c8e5a186046319940c59de3da47cf730858d971b0307cff8ed8c3a3 |
|
MD5 | a5c4ef374d377c15fdf274de38598a85 |
|
BLAKE2b-256 | 2711c01ea8164aa17e3b0f8f0bf668207dc34ed640834ff51e0b7bbd6b0c06e6 |
Hashes for pyodps-0.9.3.1-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92957c203047f6c52ee5e1866ac38ecc5333e21c4bd6b2b468b75bdf33421554 |
|
MD5 | 2ac8d4a22744528745afcf672b0489d5 |
|
BLAKE2b-256 | 5538f7dfde9b18006896495cb29ea7b5621d4155109c10ec053e6f0ccd6fbe62 |
Hashes for pyodps-0.9.3.1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 556866cdcc15a592bf42f9074b52833ff42ecf9b9fe4fab99e4b29a07ca1031c |
|
MD5 | 0d1b6131ffa351e02aebf531e109f2b5 |
|
BLAKE2b-256 | b7f530a67e045918d4cdaf6a20beb8118a6ba924997d90239f9a94cb9826e5c6 |
Hashes for pyodps-0.9.3.1-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cf8072d5da1aeef708c6cbe2267463da092c813c37201f4e740fffbd28e81d9 |
|
MD5 | 35f4e6175444aafcadbfcc9ef6b008d6 |
|
BLAKE2b-256 | 323ab590869f2ed6c32ec2252092f2d43e7fcd5ee8e43f95f27f4a687f11d22b |