-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1a4b1c7
Showing
17 changed files
with
2,387 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Publish ${package_name} to PyPI / GitHub | ||
|
||
on: | ||
push: | ||
tags: | ||
- "20*" | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish to PyPI | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Build source and wheel distributions | ||
run: | | ||
python -m pip install --upgrade build twine | ||
python -m build | ||
twine check --strict dist/* | ||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
|
||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Get Asset name | ||
run: | | ||
export PKG=$(ls dist/ | grep tar) | ||
set -- $PKG | ||
echo "name=$1" >> $GITHUB_ENV | ||
- name: Upload Release Asset (sdist) to GitHub | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: dist/${{ env.name }} | ||
asset_name: ${{ env.name }} | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
dist/ | ||
|
||
__pycache__/ | ||
.ipynb_checkpoints | ||
*.py[cod] | ||
*$py.class | ||
*.log | ||
env_pypi.yml | ||
condaenv* | ||
.venv* | ||
|
||
.pytest_cache/ | ||
|
||
dist/* | ||
build/* | ||
*.egg-info | ||
*.egg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.black-formatter" | ||
}, | ||
"python.formatting.provider": "none", | ||
"python.testing.pytestArgs": [ | ||
"tests" | ||
], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# How to release `pandas-rose` | ||
|
||
|
||
## Build the package locally | ||
|
||
``` | ||
python -m build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Brian K. Blaylock | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<div align=center> | ||
|
||
<img src="images/pandas-rose.png" title="Bing Image Creator: Cartoon chunky panda hugging rose in the wind pixel art " width=200> | ||
|
||
</div> | ||
|
||
# Pandas Rose | ||
|
||
This python package adds a custom Pandas accessor to generate polar wind rose plots from a Pandas dataframe. | ||
|
||
I don't mean to compete with the wonderful [windrose](https://github.com/python-windrose/windrose) package already available, but that package has a little too much complexity for what I wanted. This package is meant to provide a minimal, simple interface to making wind rose plots. This is done by using Pandas methods `pd.cut` and `df.groupby` and using Matplotlib regular polar axes. | ||
|
||
# Install | ||
|
||
> ## TODO: Publish and Upload to PyPI | ||
Install with pip. The requirements are only pandas, numpy, and matplotlib. | ||
|
||
```bash | ||
pip install pandas-rose | ||
``` | ||
|
||
# Usage | ||
|
||
Pandas-rose is simple. | ||
|
||
```python | ||
import pandas as pd | ||
import rose | ||
|
||
# df is a pandas dataframe with columns | ||
# "wind_speed" and "wind_direction" | ||
df = pd.DataFrame({ | ||
"wind_speed":[1,2,3,4], | ||
"wind_direction":[20, 10, 190,300] | ||
}) | ||
|
||
# Display a polar wind plot of the data | ||
df.rose.plot() | ||
``` | ||
|
||
![Alt text](images/sample_plot.png) | ||
|
||
You can specify the pandas column to use for wind direction and wind speed. You may also change the number of sectors to bin the wind direction . | ||
|
||
```python | ||
df.rose.plot( | ||
var_column="A", # name of variable column | ||
dir_column="B", # name of direction column | ||
sectors=8, # number of sectors (direction bins) | ||
bins=range(0,30,5) # specify variable bins | ||
normed=False # If True, values as percentage instead of counts | ||
colors='Blues' # Name of matplotlib colormap or list of colors | ||
) | ||
``` | ||
|
||
There are two other accessors that give some information. | ||
|
||
```python | ||
# Display a dataframe of the binned values | ||
df.rose.table(sectors=8) | ||
``` | ||
|
||
![Alt text](images/sample_table.png) | ||
|
||
```python | ||
# Display the binned data as bar graph on regular axes. | ||
df.rose.bar() | ||
``` | ||
|
||
![Alt text](images/sample_bar.png) |
Oops, something went wrong.