Transform arrays to equivalent DataFrame, note the transpose is necessary.
(self, source: Sequence[np.ndarray])
| 199 | self.source = source |
| 200 | |
| 201 | def process_numpy(self, source: Sequence[np.ndarray]): |
| 202 | """Transform arrays to equivalent DataFrame, |
| 203 | note the transpose is necessary. |
| 204 | """ |
| 205 | col_names = ["f%s" % i for i in range(len(source))] |
| 206 | df = pd.DataFrame(source, col_names).T |
| 207 | types = {} |
| 208 | for i, _ in enumerate(source): |
| 209 | types[col_names[i]] = source[i].dtype |
| 210 | df = df.astype(types) |
| 211 | return self.process_pandas(df) |
| 212 | |
| 213 | def process_pandas(self, source: pd.DataFrame): |
| 214 | self.protocol = "pandas" |