Repository: pyjanitor-devs/pyjanitor

Issue:
[INF] Set multi-test env to compat dependency and system
<!-- Thank you for your PR!

BEFORE YOU CONTINUE! Please add the appropriate three-letter abbreviation to your title.

The abbreviations can be:
- [DOC]: Documentation fixes.
- [ENH]: Code contributions and new features.
- [TST]: Test-related contributions.
- [INF]: Infrastructure-related contributions.

Also, do not forget to tag the relevant issue here as well.

Finally, as commits come in, don't forget to regularly rebase!
-->

# PR Description

Please describe the changes proposed in the pull request:

Aim:
- Set multi-test environment
- Compat different dependencies and systems

ToDo/Doing:
- [x] Set latest env: test pyjanitor work with the latest dependencies to get the minimal python version
- [ ] Set minimal env: get the minimal version of dependencies

Part of #1133

# PR Checklist

<!-- This checklist exists for newcomers who are not yet familiar with our requirements. If you are experienced with
the project, please feel free to delete this section. -->

Please ensure that you have done the following:

1. [x] PR in from a fork off your branch. Do not PR from `<your_username>`:`dev`, but rather from `<your_username>`:`<feature-branch_name>`.
<!-- Doing this helps us keep the commit history much cleaner than it would otherwise be. -->
2. [x] If you're not on the contributors list, add yourself to `AUTHORS.md`.
<!-- We'd like to acknowledge your contributions! -->
3. [x] Add a line to `CHANGELOG.md` under the latest version header (i.e. the one that is "on deck") describing the contribution.
    - Do use some discretion here; if there are multiple PRs that are related, keep them in a single line.

# Automatic checks

There will be automatic checks run on the PR. These include:

- Building a preview of the docs on Netlify
- Automatically linting the code
- Making sure the code is documented
- Making sure that all tests are passed
- Making sure that code coverage doesn't go down.

# Relevant Reviewers

<!-- Finally, please tag relevant maintainers to review. -->

Please tag maintainers to review.

- @ericmjl



Discussion:
Why does the test action don't work?
Is it a project setting problem?
I think it's because the PR is a draft, maybe?
I opened this PR and pushed an empty commit, but it still can't trigger test ci.

Resolving patch:
diff --git a/janitor/functions/encode_categorical.py b/janitor/functions/encode_categorical.py
--- a/janitor/functions/encode_categorical.py
+++ b/janitor/functions/encode_categorical.py
@@ -2,8 +2,9 @@
 from enum import Enum
 from typing import Hashable, Iterable, Union
 
-import pandas_flavor as pf
+import numpy as np
 import pandas as pd
+import pandas_flavor as pf
 from pandas.api.types import is_list_like
 
 from janitor.utils import check, check_column, deprecated_alias
@@ -191,10 +192,9 @@ def _as_categorical_checks(df: pd.DataFrame, **kwargs) -> dict:
             raise TypeError(f"{value} should be list-like or a string.")
         if is_list_like(value):
             if not hasattr(value, "shape"):
-                value = pd.Index([*value])
+                value = np.asarray(value)
 
-            arr_ndim = value.ndim
-            if (arr_ndim != 1) or isinstance(value, pd.MultiIndex):
+            if (value.ndim != 1) or isinstance(value, pd.MultiIndex):
                 raise ValueError(
                     f"{value} is not a 1-D array. "
                     "Kindly provide a 1-D array-like object."


Test patch: