Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: complete docstrings for all verbs #439

Merged
merged 2 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ jobs:
matrix:
python-version: [3.7, 3.8]
requirements: ['-r requirements.txt']
# unset doctests for earlier versions of python.
pytest_flags: ["-o addopts='' -m 'not bigquery and not snowflake'"]
include:
# historical requirements
- name: "2020-mid dependencies"
python-version: 3.8
requirements: numpy~=1.19.1 pandas~=1.1.0 SQLAlchemy~=1.3.18 psycopg2~=2.8.5 PyMySQL==1.0.2
pytest_flags: "-o addopts='' -m 'not bigquery and not snowflake'"
- name: "2021-mid dependencies"
python-version: 3.8
requirements: numpy~=1.19.1 pandas~=1.1.0 SQLAlchemy~=1.4.13 psycopg2~=2.8.5 PyMySQL==1.0.2
latest: true
pytest_flags: "-o addopts='' -m 'not bigquery and not snowflake'"
- name: "2022-early dependencies"
python-version: 3.8
requirements: numpy~=1.22.0 pandas~=1.3.5 SQLAlchemy~=1.4.29 psycopg2-binary~=2.9.3 PyMySQL==1.0.2
latest: true
- name: "2022-early dependencies"
python-version: 3.10.1
requirements: numpy~=1.22.0 pandas~=1.3.5 SQLAlchemy~=1.4.29 psycopg2-binary~=2.9.3 PyMySQL==1.0.2
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
# since bigquery takes a long time to execute,
# the tests are disabled by default.
addopts = --doctest-modules -m 'not bigquery and not snowflake'
doctest_optionflags = ELLIPSIS
markers =
skip_backend
10 changes: 7 additions & 3 deletions siuba/dply/forcats.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,13 @@ def fct_recode(fct, recat=None, **kwargs) -> pd.Categorical:
['a', 'b', 'z']
Categories (3, object): ['a', 'b', 'z']

# >>> fct_recode(cat, x = 'a', x = 'b')
# >>> fct_recode(cat, x = ['a', 'b'])
>>> fct_recode(cat, x = ['a', 'b'])
['x', 'x', 'c']
Categories (2, object): ['x', 'c']

>>> fct_recode(cat, {"x": ['a', 'b']})
['x', 'x', 'c']
Categories (2, object): ['x', 'c']

"""

Expand Down Expand Up @@ -371,7 +376,6 @@ def fct_lump(fct, n = None, prop = None, w = None, other_level = "Other", ties =
['a', 'a', 'Other', 'Other']
Categories (2, object): ['a', 'Other']

# TODO: implement prop arg
>>> fct_lump(['a', 'a', 'b', 'b', 'c', 'd'], prop = .2)
['a', 'a', 'b', 'b', 'Other', 'Other']
Categories (3, object): ['a', 'b', 'Other']
Expand Down