我有个思路,做的也成功了
先把头两列, 号码和名称安装“,”拆分了,剩下的列先安装“."全部拆分,然后将拆分中间散列(2/3/4)安装”,“拆分,然后相邻两列合并,就是有些麻烦。
- let
- 源 = List.Transform({1..3},each Web.Page(Web.Contents("http://fund.eastmoney.com/data/FundDataPortfolio_Interface.aspx?dt=8&t=2021_3&pi="&Text.From(_)&"&pn=50&mc=returnJson&st=desc&sc=qmzfe")){0}[Data]{0}[Children]{1}[Children]{0}),
- 自定义2 = Table.FromRecords(源),
- 按分隔符拆分列 = Table.SplitColumn(自定义2, "Text", Splitter.SplitTextByEachDelimiter({"["}, QuoteStyle.Csv, false), {"Text.1","Text.2"}),
- 删除的其他列1 = Table.SelectColumns(按分隔符拆分列,{"Text.2"}),
- 按分隔符拆分列1 = Table.SplitColumn(删除的其他列1, "Text.2", Splitter.SplitTextByDelimiter("[", QuoteStyle.Csv), {"Text.2.1", "Text.2.2", "Text.2.3", "Text.2.4", "Text.2.5", "Text.2.6", "Text.2.7", "Text.2.8", "Text.2.9", "Text.2.10", "Text.2.11", "Text.2.12", "Text.2.13", "Text.2.14", "Text.2.15", "Text.2.16", "Text.2.17", "Text.2.18", "Text.2.19", "Text.2.20", "Text.2.21", "Text.2.22", "Text.2.23", "Text.2.24", "Text.2.25", "Text.2.26", "Text.2.27", "Text.2.28", "Text.2.29", "Text.2.30", "Text.2.31", "Text.2.32", "Text.2.33", "Text.2.34", "Text.2.35", "Text.2.36", "Text.2.37", "Text.2.38", "Text.2.39", "Text.2.40", "Text.2.41", "Text.2.42", "Text.2.43", "Text.2.44", "Text.2.45", "Text.2.46", "Text.2.47", "Text.2.48", "Text.2.49", "Text.2.50", "Text.2.51"}),
- 删除的列 = Table.RemoveColumns(按分隔符拆分列1,{"Text.2.1"}),
- 自定义1 = Table.Split(删除的列,1),
- 自定义3 = List.Transform(自定义1,Table.Transpose),
- 自定义4 = Table.Combine(自定义3),
- 按分隔符拆分列2 = Table.SplitColumn(自定义4, "Column1", Splitter.SplitTextByEachDelimiter({"]"}, QuoteStyle.Csv, false), {"Column1"}),
- 按分隔符拆分列3 = Table.SplitColumn(按分隔符拆分列2, "Column1", Splitter.SplitTextByEachDelimiter({","}, QuoteStyle.Csv, false), {"number
- ", "Column1.2"}),
- 按分隔符拆分列4 = Table.SplitColumn(按分隔符拆分列3, "Column1.2", Splitter.SplitTextByEachDelimiter({","}, QuoteStyle.Csv, false), {"name", "new"}),
- 按分隔符拆分列5 = Table.SplitColumn(按分隔符拆分列4, "new", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"new.1", "new.2", "new.3", "new.4", "new.5"}),
- 按分隔符拆分列6 = Table.SplitColumn(按分隔符拆分列5, "new.2", Splitter.SplitTextByEachDelimiter({","}, QuoteStyle.Csv, false), {"new.2.1", "new.2.2"}),
- 按分隔符拆分列7 = Table.SplitColumn(按分隔符拆分列6, "new.3", Splitter.SplitTextByEachDelimiter({","}, QuoteStyle.Csv, false), {"new.3.1", "new.3.2"}),
- 按分隔符拆分列8 = Table.SplitColumn(按分隔符拆分列7, "new.4", Splitter.SplitTextByEachDelimiter({","}, QuoteStyle.Csv, false)),
- 自定义5 = Table.CombineColumns( Table.CombineColumns( Table.CombineColumns( Table.CombineColumns( 按分隔符拆分列8,{"new.1","new.2.1"},each Number.From(Text.Combine(_,".")),"a"),{"new.2.2","new.3.1"},each Number.From(Text.Combine(_,".")),"b"),{"new.3.2","new.4.1"},each Number.From(Text.Combine(_,".")),"c"),{"new.4.2","new.5"},each Number.From(Text.Combine(_,".")),"d")
- in
- 自定义5
复制代码 |