MCPcopy Create free account
hub / github.com/dask/dask / CustomMetadata

Class CustomMetadata

dask/dataframe/tests/test_utils_dataframe.py:118–137  ·  view source on GitHub ↗

Custom class iterator returning pandas types.

Source from the content-addressed store, hash-verified

116
117 # Iterable
118 class CustomMetadata(Iterable):
119 """Custom class iterator returning pandas types."""
120
121 def __init__(self, max=0):
122 if PANDAS_GE_300:
123 self.types = [("a", "i8"), ("c", "f8"), ("b", "str")]
124 else:
125 self.types = [("a", "i8"), ("c", "f8"), ("b", "O")]
126
127 def __iter__(self):
128 self.n = 0
129 return self
130
131 def __next__(self):
132 if self.n < len(self.types):
133 ret = self.types[self.n]
134 self.n += 1
135 return ret
136 else:
137 raise StopIteration
138
139 meta = make_meta(CustomMetadata())
140 assert (meta.columns == ["a", "c", "b"]).all()

Callers 1

test_make_metaFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_make_metaFunction · 0.68