index_constructors
/columns_constructors
not exposed on sf.Frame.from_pandas
for multi-indices.
#641
Replies: 3 comments
-
Thanks for posting this issue. StaticFrame interfaces accept either While this heterogeneity is slightly undesirable, it does not limit utility (save sometimes requiring partialing). >>> f = sf.Frame.from_element(0, index=(1,2), columns=sf.IndexHierarchy.from_product(('a', 'b'), ('2020-01-01', '2021-02-02'), index_constructors=(sf.Index, sf.IndexDate)))
>>> df = f.to_pandas()
>>> from functools import partial
>>> sf.Frame.from_pandas(df, columns_constructor=partial(sf.IndexHierarchy.from_labels, index_constructors=(sf.Index, sf.IndexNanosecond)))
<Frame>
<IndexHierarchy> a a b b <<U1>
2020-01-01T00:00:... 2021-02-02T00:00:... 2020-01-01T00:00:... 2021-02-02T00:00:... <datetime64[ns]>
<Index>
1 0 0 0 0
2 0 0 0 0
<int64> <int64> <int64> <int64> <int64> |
Beta Was this translation helpful? Give feedback.
-
I see. Personally I really hope that we can change this, as I balk at the idea of having to partial in a IndexHierarchy constructor. |
Beta Was this translation helpful? Give feedback.
-
How do you suggest we change this? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
All reactions