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

Fix breakage caused by changes in formulaic #423

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/tabmat/formula.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from formulaic import ModelMatrix, ModelSpec
from formulaic.errors import FactorEncodingError
from formulaic.materializers import FormulaMaterializer
from formulaic.materializers.base import EncodedTermStructure
from formulaic.materializers.types import FactorValues, NAAction, ScopedTerm
from formulaic.parser.types import Term
from formulaic.transforms import stateful_transform
Expand All @@ -24,6 +23,11 @@
from .sparse_matrix import SparseMatrix
from .split_matrix import SplitMatrix

try:
from formulaic.materializers.base import EncodedTermStructure
except ImportError:
from formulaic.materializers.types.formula_materializer import EncodedTermStructure
Comment on lines +26 to +29
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the formulaic version to select the import path instead of a try/except block?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I don't know in which version the change will appear. It's on main now, and my guess is 1.1, but I'm not sure.



class TabmatMaterializer(FormulaMaterializer):
"""Materializer for pandas input and tabmat output."""
Expand Down
Loading