pandas_vectors
These are a bunch of convenience functions to help with the use of vectors stored in pandas dataframes.
For example, if you have a dataframe with columns of my_vector_x, my_vector_y and my_vector_z then you find yourself writing code like this:
for vector in ['my_vector_x', 'my_vector_y', 'my_vector_z']:
df[vector[:-2] + '_new' + vector[-2:]] = func(df[vector])
Now, you can write:
import pandas_vectors as pv
for vector,new in zip(pv.indexer('my_vector'), pv.indexer('my_vector_new')):
df[new] = func(df[vector])
In fact, you can simplify it more:
df = pv.transform(df, 'my_vector', '_new', func)
All the functions that take a vector as an input take a list of vectors.
df = pv.magnitude(df, ['my_vector', 'my_new_vector'])
Functions that take df as the first argument return the modified df.
Don’t use _x, _y and _z for your vector names? No problem.
# Set the vector suffixes to the argument given
pv.set_vectornames(['_u', '_v', '_w'])
# There are also some builtin shortcuts
pv.set_vectornames('xy') # ['_x', '_y']
pv.set_vectornames('xyz') # ['_x', '_y', '_z']
pv.set_vectornames('pyr') # ['_p', '_y', '_r']
pv.set_vectornames('PYR') # ['_pitch', '_yaw', '_roll']
This can also be set temporarily using with:
pv.set_vectornames('xyz')
with pv.vectornames('xy'):
df = pv.magnitude(df, 'my_vector', '_magxy') # only xy magnitude
df = pv.magnitude(df, 'my_vector', '_mag') # xyz magnitude
Installation
pandas_vectors is available in the PyPi repository as pandas-vectors.
$ pip install pandas-vectors
CHANGELOG
0.1.1 Bugfix on function/variable 0.1 Initial Release
Metadata
Release files for pandas-vectors 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pandas_vectors-0.1.1.tar.gz | 3.9 kB | Without provenance | Details for pandas_vectors-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pandas_vectors-0.1.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for pandas_vectors-0.1.1-py2.py3-none-any.whl |
Total release size: 9.6 kB
Release files / pandas_vectors-0.1.1.tar.gz
| Download URL | pandas_vectors-0.1.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12acc0158c34270ec3c5f31c283d6c0ac0d256fe644d3676e47d9611b78dfc4b
|
|
BLAKE2b-256 checksum How to use checksums |
21eed1dd0c7371606998bbea75717c525ae6517326397180c6aa920e03512ca1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pandas_vectors-0.1.1-py2.py3-none-any.whl
| Download URL | pandas_vectors-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
80ba14760e7a86026fe841f88255745c6691e989753dd3459e0a7bc4fe9130e9
|
|
BLAKE2b-256 checksum How to use checksums |
7be1a9eb46db959040fa59adb5e6bdfcfb807286ed3560067f19934eb7fe16be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pandas-vectors 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.