core.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:PyBloqs 作者: manahl 项目源码 文件源码
def _flatten_data(data, chart_cfg, switch_zy=False):
        plot_axes_def = [(0, XAxis), (1, YAxis)]

        # Inject categories into the axis definitions of the plot
        if isinstance(data, NDFrame):
            for i, plot_axis in plot_axes_def[:data.ndim]:
                categories = data.axes[i]
                # Skip numeric indices
                if not categories.is_numeric():
                    chart_cfg = chart_cfg.inherit_many(plot_axis(categories=list(categories)))

        data = [list(index) + [value] for index, value in list(np.ndenumerate(data))]

        if switch_zy:
            for i in xrange(len(data)):
                tmp = data[i][-1]
                data[i][-1] = data[i][-2]
                data[i][-2] = tmp

        return data, chart_cfg
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号