codecov-io: # [Codecov](https://codecov.io/gh/cosmicBboy/pandera/pull/64?src=pr&el=h1) Report
> Merging [#64](https://codecov.io/gh/cosmicBboy/pandera/pull/64?src=pr&el=desc) into [master](https://codecov.io/gh/cosmicBboy/pandera/commit/3c96cb1ef97dc818ec047f5745a3341d5d70993e?src=pr&el=desc) will **increase** coverage by `0.51%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/cosmicBboy/pandera/pull/64/graphs/tree.svg?width=650&token=OXz3BoBZMN&height=150&src=pr)](https://codecov.io/gh/cosmicBboy/pandera/pull/64?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##           master     #64      +/-   ##
=========================================
+ Coverage   89.69%   90.2%   +0.51%     
=========================================
  Files           1       1              
  Lines         291     296       +5     
=========================================
+ Hits          261     267       +6     
+ Misses         30      29       -1
```


| [Impacted Files](https://codecov.io/gh/cosmicBboy/pandera/pull/64?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandera/pandera.py](https://codecov.io/gh/cosmicBboy/pandera/pull/64/diff?src=pr&el=tree#diff-cGFuZGVyYS9wYW5kZXJhLnB5) | `90.2% <100%> (+0.51%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/cosmicBboy/pandera/pull/64?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/cosmicBboy/pandera/pull/64?src=pr&el=footer). Last update [3c96cb1...a54c5c4](https://codecov.io/gh/cosmicBboy/pandera/pull/64?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

diff --git a/pandera/pandera.py b/pandera/pandera.py
index b11eaa4..c191f6c 100644
--- a/pandera/pandera.py
+++ b/pandera/pandera.py
@@ -684,9 +684,8 @@ class Column(SeriesSchemaBase):
             then assumes one of the valid pandas string values:
             http://pandas.pydata.org/pandas-docs/stable/basics.html#dtypes
         :type pandas_dtype: str|PandasDtype
-        :param checks: If element_wise is True, then callable signature should
-            be:
-            x -> x where x is a scalar element in the column. Otherwise,
+        :param checks: if element_wise is True, then callable signature should
+            be: x -> bool where x is a scalar element in the column. Otherwise,
             x is assumed to be a pandas.Series object.
         :type checks: callable
         :param nullable: Whether or not column can contain null values.
@@ -741,6 +740,18 @@ class Column(SeriesSchemaBase):
         return "<Schema Column: '%s' type=%s>" % (self._name, dtype)
 
 
+def _get_fn_argnames(fn):
+    if sys.version_info.major >= 3:
+        arg_spec_args = inspect.getfullargspec(fn).args
+    else:
+        arg_spec_args = inspect.getargspec(fn).args
+
+    if inspect.ismethod(fn) and arg_spec_args[0] == "self":
+        # don't include "self" argument
+        arg_spec_args = arg_spec_args[1:]
+    return arg_spec_args
+
+
 def check_input(schema, obj_getter=None):
     """Validate function argument when function is called.
 
@@ -770,10 +781,7 @@ def check_input(schema, obj_getter=None):
             if obj_getter in kwargs:
                 kwargs[obj_getter] = schema.validate(kwargs[obj_getter])
             else:
-                if sys.version_info.major >= 3:
-                    arg_spec_args = inspect.getfullargspec(fn).args
-                else:
-                    arg_spec_args = inspect.getargspec(fn).args
+                arg_spec_args = _get_fn_argnames(fn)
                 args_dict = OrderedDict(
                     zip(arg_spec_args, args))
                 args_dict[obj_getter] = schema.validate(args_dict[obj_getter])

handle `self` argument when using check_input in class method when str obj_getter is supplied
Check is the wrapped function is a class method:

https://stackoverflow.com/questions/5963729/check-if-a-function-is-a-method-of-some-object

if so, ignore the first argument.
diff --git a/tests/test_pandera.py b/tests/test_pandera.py
index d8f5aeb..063ac50 100644
--- a/tests/test_pandera.py
+++ b/tests/test_pandera.py
@@ -272,6 +272,50 @@ def test_check_function_decorator_transform():
     assert "column2" in result2[1]
 
 
+def test_check_input_method_decorators():
+    in_schema = DataFrameSchema({"column1": Column(String)})
+    out_schema = DataFrameSchema({"column2": Column(Int)})
+    dataframe = pd.DataFrame({"column1": ["a", "b", "c"]})
+
+    def _transform_helper(df):
+        return df.assign(column2=[1, 2, 3])
+
+    class TransformerClass(object):
+
+        @check_input(in_schema)
+        @check_output(out_schema)
+        def transform_first_arg(self, df):
+            return _transform_helper(df)
+
+        @check_input(in_schema, 0)
+        @check_output(out_schema)
+        def transform_first_arg_with_list_getter(self, df):
+            return _transform_helper(df)
+
+        @check_input(in_schema, 1)
+        @check_output(out_schema)
+        def transform_secord_arg_with_list_getter(self, x, df):
+            return _transform_helper(df)
+
+        @check_input(in_schema, "df")
+        @check_output(out_schema)
+        def transform_secord_arg_with_dict_getter(self, x, df):
+            return _transform_helper(df)
+
+    def _assert_expectation(result_df):
+        assert isinstance(result_df, pd.DataFrame)
+        assert "column2" in result_df.columns
+
+    transformer = TransformerClass()
+    _assert_expectation(transformer.transform_first_arg(dataframe))
+    _assert_expectation(
+        transformer.transform_first_arg_with_list_getter(dataframe))
+    _assert_expectation(
+        transformer.transform_secord_arg_with_list_getter(None, dataframe))
+    _assert_expectation(
+        transformer.transform_secord_arg_with_dict_getter(None, dataframe))
+
+
 def test_string_dtypes():
     # TODO: add tests for all datatypes
     schema = DataFrameSchema(

pip install -e .
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
coverage==6.2
docutils==0.17.1
enum34==1.1.10
flake8==5.0.4
idna==3.10
imagesize==1.4.1
importlib-metadata==4.2.0
iniconfig==1.1.1
Jinja2==3.0.3
MarkupSafe==2.0.1
mccabe==0.7.0
numpy==1.19.5
packaging==21.3
pandas==1.1.5
-e git+https://github.com/cosmicBboy/pandera.git@3c96cb1ef97dc818ec047f5745a3341d5d70993e#egg=pandera
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.27.1
scipy==1.5.4
six==1.17.0
snowballstemmer==2.2.0
Sphinx==4.3.2
sphinx-rtd-theme==1.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
wrapt==1.16.0
zipp==3.6.0

name: pandera
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - attrs==22.2.0
      - babel==2.11.0
      - charset-normalizer==2.0.12
      - codecov==2.1.13
      - coverage==6.2
      - docutils==0.17.1
      - enum34==1.1.10
      - flake8==5.0.4
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.2.0
      - iniconfig==1.1.1
      - jinja2==3.0.3
      - markupsafe==2.0.1
      - mccabe==0.7.0
      - numpy==1.19.5
      - packaging==21.3
      - pandas==1.1.5
      - pluggy==1.0.0
      - py==1.11.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - requests==2.27.1
      - scipy==1.5.4
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==4.3.2
      - sphinx-rtd-theme==1.3.0
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - wrapt==1.16.0
      - zipp==3.6.0
prefix: /opt/conda/envs/pandera

tests/test_pandera.py::test_check_input_method_decorators
tests/test_pandera.py::test_column tests/test_pandera.py::test_series_schema tests/test_pandera.py::test_vectorized_checks tests/test_pandera.py::test_series_schema_multiple_validators tests/test_pandera.py::test_dataframe_schema tests/test_pandera.py::test_dataframe_schema_strict tests/test_pandera.py::test_index_schema tests/test_pandera.py::test_check_function_decorators tests/test_pandera.py::test_check_function_decorator_errors tests/test_pandera.py::test_check_function_decorator_transform tests/test_pandera.py::test_string_dtypes tests/test_pandera.py::test_nullable_int tests/test_pandera.py::test_coerce_dtype tests/test_pandera.py::test_required tests/test_pandera.py::test_check_groupby tests/test_pandera.py::test_check_groupby_multiple_columns tests/test_pandera.py::test_check_groups tests/test_pandera.py::test_groupby_init_exceptions tests/test_pandera.py::test_hypothesis tests/test_pandera.py::test_hypothesis_group_length tests/test_pandera.py::test_hypothesis_unavailable_relationship
pandera/pandera.py
pandera/pandera.py