Skip to content

Commit

Permalink
bump version to v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LSYS committed Sep 21, 2022
2 parents f610b6f + a34f143 commit af97d31
Show file tree
Hide file tree
Showing 14 changed files with 494 additions and 63 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: DocLinks

on:
push:
branches: [ "main", "docs" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '0 0 1 * *'

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@v1
27 changes: 27 additions & 0 deletions .github/workflows/nb-pkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Notebooks-pkg

on: workflow_dispatch

jobs:
build_linux:
name: Build ubuntu wheel for python${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install forestplot
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f examples/requirements.txt ]; then pip install -r examples/requirements.txt; fi
- name: Test notebook(s)
run: |
cd examples && runpynb readme-examples --sequence
33 changes: 33 additions & 0 deletions .github/workflows/nb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Notebooks

on:
push:
branches: [ "main", "patch", "feature" ]
pull_request:
branches: [ "main" ]

jobs:
build_linux:
name: Build ubuntu wheel for python${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f examples/requirements.txt ]; then pip install -r examples/requirements.txt; fi
- name: Test notebook(s)
run: |
cd examples
runpynb get-sleep --sequence
runpynb readme-examples --sequence
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*.xlsx
scratch/*
forestplot/scratch/*
examples/*

# Created by https://www.toptal.com/developers/gitignore/api/python,jupyternotebooks
# Edit at https://www.toptal.com/developers/gitignore?templates=python,jupyternotebooks
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Lucas Shen Y. S.

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.
372 changes: 351 additions & 21 deletions README.md

Large diffs are not rendered by default.

Binary file modified docs/images/group-grouporder-pvalue-sort-colorrows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/group-grouporder-sort.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions examples/get-sleep.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"id": "e05019fe",
"metadata": {
"ExecuteTime": {
"end_time": "2022-07-30T10:58:51.984970Z",
"start_time": "2022-07-30T10:58:29.358300Z"
"end_time": "2022-09-18T05:01:11.859723Z",
"start_time": "2022-09-18T05:01:04.107411Z"
}
},
"outputs": [
Expand Down Expand Up @@ -199,8 +199,8 @@
"id": "e66b467a",
"metadata": {
"ExecuteTime": {
"end_time": "2022-07-30T10:58:52.025067Z",
"start_time": "2022-07-30T10:58:51.984970Z"
"end_time": "2022-09-18T05:01:11.892027Z",
"start_time": "2022-09-18T05:01:11.862006Z"
},
"code_folding": [],
"scrolled": true
Expand Down Expand Up @@ -270,7 +270,7 @@
"source": [
"# Prep variable lablels (fold cell)\n",
"# varlabels: http://fmwww.bc.edu/ec-p/data/wooldridge/sleep75.des\n",
"df_label = (pd.read_csv('data/sleep75-des.csv')\n",
"df_label = (pd.read_csv('data/sleep75-des.csv', encoding=\"ISO-8859-1\")\n",
" .assign(label=lambda df: df['des'].str.encode('ascii', 'ignore').str.decode('ascii'))\n",
" .drop(['des'], axis=1)\n",
" .set_index('var')\n",
Expand All @@ -287,8 +287,8 @@
"id": "efdb6621",
"metadata": {
"ExecuteTime": {
"end_time": "2022-07-30T10:58:56.694344Z",
"start_time": "2022-07-30T10:58:52.025067Z"
"end_time": "2022-09-18T05:01:14.801972Z",
"start_time": "2022-09-18T05:01:11.897008Z"
},
"scrolled": true
},
Expand Down Expand Up @@ -865,8 +865,8 @@
"id": "c988902c",
"metadata": {
"ExecuteTime": {
"end_time": "2022-07-30T10:58:56.758504Z",
"start_time": "2022-07-30T10:58:56.694344Z"
"end_time": "2022-09-18T05:01:14.852081Z",
"start_time": "2022-09-18T05:01:14.801972Z"
}
},
"outputs": [],
Expand All @@ -884,8 +884,8 @@
"id": "d0b63fbd",
"metadata": {
"ExecuteTime": {
"end_time": "2022-07-30T10:58:56.790581Z",
"start_time": "2022-07-30T10:58:56.766535Z"
"end_time": "2022-09-18T05:01:14.876068Z",
"start_time": "2022-09-18T05:01:14.852081Z"
},
"scrolled": true
},
Expand Down
42 changes: 19 additions & 23 deletions examples/readme-examples.ipynb

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pingouin
jupyter
runpynb
pandas
numpy
14 changes: 9 additions & 5 deletions forestplot/dataframe_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ def sort_data(
sortby = estimate

if groupvar is not None:
dataframe.sort_values([groupvar, sortby], ascending=sortascend, inplace=True)
dataframe.sort_values(
[groupvar, sortby], ascending=[True, sortascend], inplace=True
)
else:
dataframe.sort_values(sortby, ascending=sortascend, inplace=True)
return dataframe.reset_index(drop=True)
Expand Down Expand Up @@ -123,7 +125,7 @@ def load_data(name: str, **param_dict: Optional[Any]) -> pd.core.frame.DataFrame
Example data available now:
- mortality
The source of these data will be from: https://github.com/LSYS/pyforestplot/tree/main/examples/data.
The source of these data will be from: https://github.com/LSYS/forestplot/tree/main/examples/data.
Parameters
----------
Expand All @@ -134,13 +136,15 @@ def load_data(name: str, **param_dict: Optional[Any]) -> pd.core.frame.DataFrame
-------
pd.core.frame.DataFrame.
"""
available_data = ["mortality"]
available_data = ["mortality", "sleep", "sleep-untruncated"]
name = name.lower().strip()
if name in available_data:
url = f"https://raw.githubusercontent.com/lsys/pyforestplot/main/examples/data/{name}.csv"
url = (
f"https://raw.githubusercontent.com/lsys/forestplot/main/examples/data/{name}.csv"
)
df = pd.read_csv(url, **param_dict)
if name == "sleep":
df["n"] = df["n"].map(object)
df["n"] = df["n"].astype("str")
return df
else:
available_data_str = ", ".join(available_data)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dataframe_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def test_sort_data():
input_string = ["c", "a", "b"]
input_numeric = [3, -1, 2]

output_string = ["c", "b", "a"]
output_numeric = [3, 2, -1]
output_string = ["a", "b", "c"]
output_numeric = [-1, 2, 3]

# Vanilla sort
input_df = pd.DataFrame({"estimate": input_numeric, "groupvar": input_string})
Expand Down

0 comments on commit af97d31

Please sign in to comment.