Allow fit methods to accept pd.Series and pd.DataFrame (#62)#92
Merged
TomeHirata merged 5 commits intomainfrom Mar 9, 2026
Merged
Allow fit methods to accept pd.Series and pd.DataFrame (#62)#92TomeHirata merged 5 commits intomainfrom
TomeHirata merged 5 commits intomainfrom
Conversation
TomeHirata
reviewed
Mar 3, 2026
dte_adj/util.py
Outdated
| ) | ||
|
|
||
|
|
||
| def _convert_to_ndarray(data: object) -> np.ndarray: |
Collaborator
There was a problem hiding this comment.
Can we update the type hint to Dataframe, ndarray and Series only?
TomeHirata
reviewed
Mar 3, 2026
tests/test_pandas_input.py
Outdated
| @@ -0,0 +1,161 @@ | |||
| import unittest | |||
Collaborator
There was a problem hiding this comment.
Can we use test_utils.py?
Collaborator
There was a problem hiding this comment.
I think it's fine to test _convert_to_ndarray only. Alternativel, we can add a test case for each estimator class.
TomeHirata
reviewed
Mar 3, 2026
dte_adj/stratified.py
Outdated
Collaborator
There was a problem hiding this comment.
Can we update the type hint for fit?
TomeHirata
reviewed
Mar 3, 2026
| """ | ||
| super().__init__() | ||
|
|
||
| def fit( |
TomeHirata
reviewed
Mar 3, 2026
| """ | ||
| super().__init__() | ||
|
|
||
| def fit( |
TomeHirata
reviewed
Mar 9, 2026
dte_adj/local.py
Outdated
| treatment_indicator (np.ndarray): Treatment indicator variable (D). | ||
| outcomes (np.ndarray): Scalar-valued observed outcome. | ||
| strata (np.ndarray): Stratum indicators. | ||
| covariates (ArrayLike): Pre-treatment covariates. |
Collaborator
There was a problem hiding this comment.
ArrayLike is not a public API; so let's probably remove these types from the docstring, as it's already shown in the type hints.
TomeHirata
previously approved these changes
Mar 9, 2026
Collaborator
TomeHirata
left a comment
There was a problem hiding this comment.
Left a minor comment, otherwise LGTM
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #62
Summary
pd.Seriespd.DataFramepl.Seriespl.DataFramelisttuplenp.ndarrayinside thefitmethodArrayLiketype alias and update type hints for_convert_to_ndarrayand all fit methodsChanges
_convert_to_ndarrayhelper andArrayLiketype indte_adj/util.pyfitmethods of all 6 estimator classesnp.ndarraytoArrayLikeforfitmethod parameterspyproject.tomltests/test_utils.pywith test cases for_convert_to_ndarray