Directions overlay for working with pandas in an analysis environment
Project description
dovpanda
Directions OVer PANDAs
Directions overlay for working with pandas in an analysis environment.
If you think your task is common enough, it probably is, and Pandas probably has a built-in solution.
dovpanda is an overlay module that tries to understand what you are trying to do with your data, and help you
find easier ways to write your code.
Usage
The basic usage of dovpanda
is very east. you just import it after you import pandas
import pandas as pd
import dovpanda
This is it. From now on you can expect dovpanda
to come with helpful directions while
you are writing you code.
Example
In [3]: df = pd.DataFrame({'a':list('xxyy'),'b':[40,50,60,70], 'time':['18:02','18:45','20:12','21:50']})
...: df['time'] = pd.to_datetime(df.time)
...: df['hour'] = df.time.dt.hour
In [4]: df.groupby('hour').b.sum()
===== Seems like you are grouping by a column named 'hour', consider setting the your
time column as index and then use df.resample('h') =====
Out[4]:
hour
18 90
20 60
21 70
Name: b, dtype: int64
Notebook Support
Running dovpanda
in a notebook environment will display rendered dismissable html.
Advanced Usage
Random Tips
dovpanda.tip()
will give you a random pandas
tip.
Change Display
use dovpanda.set_output
if you want to change output.
In [14]: dovpanda.set_output('display')
In [15]: df.iterrows()
===== iterrows is not recommended, and in the majority of cases will have better alternatives =====
Out[15]: <generator object DataFrame.iterrows at 0x110fe4318>
In [16]: dovpanda.set_output('print')
In [17]: df.iterrows()
iterrows is not recommended, and in the majority of cases will have better alternatives
Out[17]: <generator object DataFrame.iterrows at 0x112c408b8>
In [18]: dovpanda.set_output('warning')
In [19]: df.iterrows()
WARNING:dovpanda:iterrows is not recommended, and in the majority of cases will have better alternatives
Out[19]: <generator object DataFrame.iterrows at 0x110ee7e58>
In [20]: dovpanda.set_output('off')
In [21]: df.iterrows()
Out[21]: <generator object DataFrame.iterrows at 0x1047c4d68>```
Documentation
-------------
The full documentation is at http://dovpanda.rtfd.org.
History
-------
0.0.2 (2019-10-30)
++++++++++++++++++
* First release on PyPI.
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 Distribution
Hashes for dovpanda-0.0.1a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aa6ea51f635860017a127dd67f02e9c3e70e6265739aa870ac8abfb4aa1193c |
|
MD5 | e18907abcbac6d3f24419c4016d13246 |
|
BLAKE2b-256 | ea065810579c56f5c91f196803bf395ae5c75cff4a68b5bdd7b8795de0bca0ab |