How to use the deepdish.io.ls.PandasDataFrameNode function in deepdish

To help you get started, we’ve selected a few deepdish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uchicago-cs / deepdish / deepdish / io / ls.py View on Github external
N = int(s)
            lst = ListNode(typename=level._v_title.split(':')[0])
            for i in range(N):
                t = node.children['i{}'.format(i)]
                lst.append(t)
            return lst
        elif level._v_title.startswith('nonetype:'):
            return ValueNode(None)
        elif is_pandas_dataframe(level):
            pandas_type = level._v_attrs['pandas_type']
            if raw:
                # Treat as regular dictionary
                pass
            elif pandas_type == 'frame':
                shape = _pandas_shape(level)
                new_node = PandasDataFrameNode(shape)
                return new_node
            elif pandas_type == 'series':
                try:
                    values = level._v_children['values']
                    size = len(values)
                    dtype = values.dtype
                except:
                    size = None
                    dtype = None
                new_node = PandasSeriesNode(size, dtype)
                return new_node
            elif pandas_type == 'wide':
                shape = _pandas_shape(level)
                new_node = PandasPanelNode(shape)
                return new_node
            # else: it will simply be treated as a dict