You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Palantir Foundry中如何将NAS文件夹的Excel文件列表转为可用数据集?

在Palantir Foundry中将NAS连接的XLSX文件列表转为流水线可用数据集
  • 确认NAS连接配置
    先在Foundry的Data Connections页面检查你的NAS连接,确保已启用文件扫描功能,能正常识别目标文件夹下的XLSX文件。

  • 创建File Transform处理文件
    在Foundry中新建一个Python类型的Transform,通过文件系统API读取NAS文件并转换为数据集:

    from transforms.api import transform, Input, Output
    from foundry.filesystem import FileSystem
    import pandas as pd
    
    @transform(
        output=Output("/your/workspace/path/output_dataset"),
    )
    def combine_xlsx(ctx, output):
        # 替换为你的NAS连接名称和目标文件夹路径
        nas_fs = FileSystem.get("your-nas-connection-id")
        xlsx_paths = [file for file in nas_fs.ls("/target/nas/folder") if file.endswith(".xlsx")]
    
        # 读取并合并所有XLSX文件
        data_frames = []
        for path in xlsx_paths:
            with nas_fs.open(path, "rb") as file:
                df = pd.read_excel(file, engine="openpyxl")
                data_frames.append(df)
        combined_data = pd.concat(data_frames, ignore_index=True)
    
        # 写入输出数据集
        output.write_dataframe(combined_data)
    
  • 配置Python依赖
    在Transform的requirements.txt中添加必要依赖:

    pandas>=1.5.0
    openpyxl>=3.0.0
    
  • 验证与调度
    提交Transform运行,验证输出数据集的内容是否符合预期。如果NAS文件会定期更新,可在Transform的调度设置中配置定时任务,实现数据集自动同步。

内容的提问来源于stack exchange,提问作者Jresearcher

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 20:22:04