2024-04-28 20:27:43 发布
网友
我正在使用spark df profiling包在azure databricks中生成分析报告。但是ProfileReport中的to_file函数生成了一个我无法在azure blob上编写的html文件。在
to_file
已经尝试过:
profile = spark_df_profiling.ProfileReport(df) profile.to_file(paths in already tried)
我想将输出保存在提供的路径上
在我查看了julioasotodv/spark-df-profiling版本v1.1.13的源代码后,我通过下面的代码解决了它。首先,请参考Azure Databricks官方文档^{}和^{}了解dbutils如何将数据写入指定的数据源,如Azure存储。在
julioasotodv/spark-df-profiling
v1.1.13
dbutils
这是我的示例代码,它适用于我的Azure数据库和Azure存储。在
storage_account_name='<your storage account name>' storage_account_access_key='<your storage account key>' spark.conf.set( "fs.azure.account.key."+storage_account_name+".blob.core.windows.net", storage_account_access_key) # My sample pandas dataframe for testing import pandas as pd d = {'col1': [1, 2], 'col2': [3, 4]} pd_df = pd.DataFrame(data=d) import spark_df_profiling from spark_df_profiling.templates import template df = spark.createDataFrame(pd_df) profile = spark_df_profiling.ProfileReport(df) dbutils.fs.put("wasbs://<your container name>@ppas.blob.core.windows.net/test.html", template('wrapper').render(content=profile.html))
我可以通过结果True看到它的工作原理,并将29806字节输出到azureblob,然后在azurestorageexplorer中检查它。在
True
希望有帮助。在
在我查看了} 和^{} 了解
julioasotodv/spark-df-profiling
版本v1.1.13
的源代码后,我通过下面的代码解决了它。首先,请参考Azure Databricks官方文档^{dbutils
如何将数据写入指定的数据源,如Azure存储。在这是我的示例代码,它适用于我的Azure数据库和Azure存储。在
我可以通过结果
True
看到它的工作原理,并将29806字节输出到azureblob,然后在azurestorageexplorer中检查它。在希望有帮助。在
相关问题 更多 >
编程相关推荐