如何同时展开一行列表中的所有列表? [英] How can I expand all lists in a row of lists at the same time?

查看:25
本文介绍了如何同时展开一行列表中的所有列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一次扩展此表中的所有列表而不必显式命名(硬编码)每一列.我确实想假设所有列在行中都有一个列表.我还希望能够将解决方案应用于列数比示例中少或多的表.该表可能会减少或增加其列数,并且列的名称可能会更改,这就是我不想使用显式列名称的原因.

我在各种论坛站点上找到了一些关于一次扩展多个列表的主题,但它们都不仅仅涉及执行我上面描述的操作,而且都在某种程度上使我感到困惑,因为我已经尝试过使它们适合我的需要.

@MarcelBeug 在

那我该怎么做?

解决方案

您希望跨每列聚合 Table.ExpandListColumn 函数:

letSource = #table({"A", "B"}, {{ {1,2}, {3,4}} }),扩展 = List.Accumulate(Table.ColumnNames(来源),来源,(状态,列)=>Table.ExpandListColumn(state, column))在展开

I would like to expand all of the lists in this table at once without having to explicitly name (hard-code) each column. I do want to assume that all columns have a list in the row. I also want to be able to apply the solution to a table with less or more columns than are in the example. The table might decrease or increase its number of columns and the columns' names might change, which is why I don't want to use explicit column names.

I've found a few threads about expanding multiple lists at once, at various forum sites, but they all address more than just doing what I describe above and have all confused me to one degree or another as I've tried to fit them to my need.

@MarcelBeug provides a detailed solution at this site (as do other folks too). I'm using @MarcelBeug's function, and it works great; but I'd like to tailor it to just what I'm seeking, as mentioned above, and I'm having trouble doing that.

So how do I do this?

解决方案

You want to aggregate the Table.ExpandListColumn function across each column:

let
    Source = #table({"A", "B"}, {{ {1,2}, {3,4}} }),
    Expanded = List.Accumulate(
        Table.ColumnNames(Source), 
        Source, 
        (state, column) => Table.ExpandListColumn(state, column))
in
    Expanded

这篇关于如何同时展开一行列表中的所有列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆