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.7.12-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b690ebcf19d7c8dcf30ff441fc6e035e7436cd39db7fb2782216405fa7b3485d |
|
MD5 | 262176a21b7419b4f152717e2671ffef |
|
BLAKE2b-256 | 12c074464908946d05ddd344b5bef17fad2f65558cecb066e73f50f2368fb3f5 |
Hashes for pyodps-0.7.12-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 008655b695350a900162386fa7f5b183ceb323868ac7c915080756424b83acd9 |
|
MD5 | af3537080e4a600342ec3860270c509e |
|
BLAKE2b-256 | 95c739629e78d7856a8c3286c04d651843a309cfd9971fc2e38d7a104b80538b |
Hashes for pyodps-0.7.12-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b880f86ce60a7806ec93cf6a6d1fa4d9a8007c4d1e1974ef8851d6bc101c0ef1 |
|
MD5 | 8f7d640e676fa8df147abb11a5c72ce3 |
|
BLAKE2b-256 | dabe6dd6c9a6ac07fdc7c07761ab7638a67a5eba186ff2f4fa48ff7b1f00e03a |
Hashes for pyodps-0.7.12-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c047f1a577b429a9677515a4acc5dc1a585a370961eb93a73c844b8e57637571 |
|
MD5 | 5dafb4d5bf71671957e65d63551fd80d |
|
BLAKE2b-256 | 4088cb2aacf75a53282c91def020e7852aaa680a501d4430a521e4fd95341c84 |
Hashes for pyodps-0.7.12-cp36-cp36m-macosx_10_11_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 | b2ea2d13ebd6d48e5d3fc180db17234203bce353e0e9a81799d72f3cfb69cafe |
|
MD5 | 4189c4ec048f0e731742f9802a3e79e5 |
|
BLAKE2b-256 | 2f9c2e29f8ee9feb4dcdf659d842b964afba9ef45de24d6e8f8306db619e2a05 |
Hashes for pyodps-0.7.12-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 284e3b2c3628ce2225e7adf6c9047e0a9aa0cda4d40b642e243bb8bb76bc1e63 |
|
MD5 | 8b2d553a7f3ea048d9041542de01f0c0 |
|
BLAKE2b-256 | cef9217935bab93603fb549630293eea801faadfa841665289c5ba7f79e56db8 |
Hashes for pyodps-0.7.12-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84e6f808511dacb44fa4fc7a465fe3d7c53867f5f43bc97865e99d2ab41c4fd6 |
|
MD5 | 3db2bf7781740c4754f7c4dce343d6a4 |
|
BLAKE2b-256 | 68e2740e1b804643285939b8d7d8c789e1c32b94e8d88b9e40f6990236311b4b |
Hashes for pyodps-0.7.12-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12d0080f76ac58a0c2e676f51389b8fe265e5ec4ab80af77d9f80834833f5924 |
|
MD5 | 9ceae27011b286b0f5dd471ee8b8bf0e |
|
BLAKE2b-256 | 2e7376cf083164d92d54316779821ed0702fd0f637419e7f1296876ab2ee95ba |
Hashes for pyodps-0.7.12-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d1636d0d5cdf469602504241b8e8cc48580103a8606b68ffadcd1121ecce519 |
|
MD5 | 88f19a8f3a9d123291ce37b5572e9b4a |
|
BLAKE2b-256 | f4500d4ec4b092af0782028017fc8c969baeb415ad2794a0a5cde0289addbcaf |
Hashes for pyodps-0.7.12-cp35-cp35m-macosx_10_11_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 | cb69693e372a1381e10008b147ebbb20bdec703befe100714d421fa0deb61bc4 |
|
MD5 | 6f130bbe5f1ac86156e2f3cab88c60c2 |
|
BLAKE2b-256 | f3be5cd305acf012080ca8995b7fff9b2e21e65892dd0936e1c1d0f8a9a9ce2f |
Hashes for pyodps-0.7.12-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e2e181b61f16d7a60e9523a0fea46dab090f255ef4bf9e674c6e82f31d69245 |
|
MD5 | e2001b7597c54a5afdb2844c5114c18c |
|
BLAKE2b-256 | 4087e7eabab2434a5f7590bec91dc0f9e5ca11d06bcac3244ccb67525f543274 |
Hashes for pyodps-0.7.12-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cf01cb542dbdfece290fc2b7fd7e95c8a84d217e6873eb8312be944730deaf1 |
|
MD5 | fc732364857984784524d1731d2008b2 |
|
BLAKE2b-256 | 50efe266a7badd5e7485ddbd1ca73fa053c479f689330e127b71002b99a6688f |
Hashes for pyodps-0.7.12-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2c2e7a04d637f726eb0393b23f31250ae0ac7a574642e49ffe108621e140e0d |
|
MD5 | fcd7d7ebeca64212ebd6adec93a27bf8 |
|
BLAKE2b-256 | ba69362a2b586758a8d52d77225a7f4f2167b6688d4b02f88ff5f309c567ecf9 |
Hashes for pyodps-0.7.12-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d6da896e8978ccab3e5689a4882066d4bb2cc46012ace2dbd5a0fd54925608b |
|
MD5 | 6cd20a40e48de7a931ad0aef238facce |
|
BLAKE2b-256 | 9e267b38285bcdc57e23a14a7f32c7fbef88a1bc84e99a5e6b77400684867bfc |
Hashes for pyodps-0.7.12-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 691fe47e5fee6a8419f5df0f54f5d68696fee57a9c215aa24610b8d3887e8fdd |
|
MD5 | ad65f72cb03266e6886aa73d8d98b512 |
|
BLAKE2b-256 | d953e7ca025f8fe40d7a7d480cd13e2038eae648fb13d7591959410ee6e240a7 |
Hashes for pyodps-0.7.12-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e6f1ace52e9d89148313aa940f31d96671b2d9aeb30decbb18cfd1adf5d9caa |
|
MD5 | 3b4c0d6366a0ee3e024b40b2410fd3af |
|
BLAKE2b-256 | b249f08da8c756af1ed348153a122da6047839079971519109256a8eb22eec24 |
Hashes for pyodps-0.7.12-cp27-cp27m-macosx_10_11_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 | 83062872e29ccaad80e06f4301dc043665eb900c6093e2541d307f499d4bfe9e |
|
MD5 | 139bbb6612f3e09861859abf02a02790 |
|
BLAKE2b-256 | af9dc95867e58f5f8fafb1f51604d09e84eb62098907b88bd2a016376ff24270 |