File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -124,8 +124,18 @@ def _convert_extras_to_checks(extras: Dict[str, Any]) -> List[Check]:
124
124
125
125
return checks
126
126
127
+ class MetaDataFrameModel (MetaModel ):
128
+ """A metaclass for DataFrameModel to provide iter support."""
129
+
130
+ def to_schema (cls ) -> DataFrameSchema :
131
+ """Create :class:`~pandera.DataFrameSchema` from the class."""
132
+ raise NotImplementedError
133
+
134
+ def __iter__ (cls ) -> Iterable [str ]:
135
+ """Iterate over the fields of the schema"""
136
+ return iter (cls .to_schema ().columns )
127
137
128
- class DataFrameModel (BaseModel ):
138
+ class DataFrameModel (BaseModel , metaclass = MetaDataFrameModel ):
129
139
"""Definition of a :class:`~pandera.api.pandas.container.DataFrameSchema`.
130
140
131
141
*new in 0.5.0*
You can’t perform that action at this time.
0 commit comments