web-scraping - 仅将 IMAGE 函数添加到通过 IMPORTXML 收集的一列数据中
问题描述
我从单个导入数据IMPORTXML
并将其分为两列,如下所示:
=ArrayFormula(IFERROR(HLOOKUP(1,{1;IMPORTXML(A1,"
//table[@class='table squad sortable']//td[@class='photo']/a/img/@src |
//table[@class='table squad sortable']//td[@class='name large-link']/a/@href")},
(ROW(A:A)+1)*2-TRANSPOSE(sort(ROW($A$1:$A$2)+0,1,0)))))
我想知道是否有任何方法不必多次调用 importxml 并IMAGE
仅在第一列中添加该函数,因此我不必像目前那样将其单独放置。
解决方案
你可以用一个公式做的最好的事情是:
=ARRAYFORMULA({IFERROR(IMAGE(IMPORTXML(A1,
"//table[@class='table squad sortable']//td[@class='photo']/a/img/@src"))),
QUERY(IFERROR(HLOOKUP(1, {1; IMPORTXML(A1,
"//table[@class='table squad sortable']//td[@class='photo']/a/img/@src | //table[@class='table squad sortable']//td[@class='name large-link']/a/@href")},
(ROW(A:A)+1)*2-TRANSPOSE(SORT(ROW($A$1:$A$2)+0, 1, 0)))), "where Col1 !=''", 0)})
推荐阅读
- listview - 颤振不能在包含两个列表视图的屏幕中使用 reordableListView
- r - 有没有办法采取多种方式并将它们存储在R中的向量中
- javascript - 如何为复选框实现 requiredUnless 验证器
- c# - 添加项目后返回 null 的列表
- r - 使用 XTS 根据不同月份将数据聚合到每年
- python - 什么是 numpy where 的 dask 等价物?
- docker - 无法启动 elasticsearch docker 容器
- netsuite - 在 NetSuite 保存的搜索中确定套件/组件的利润因子(或百分比)(销售价格/(数量之和 * member_cost))
- python - 如何在 Xcode 中使用 librosa 进行音频特征提取?
- javascript - 字符串与预期的模式不匹配 d3 选择