[英]how to read an excel file using pandad pd.read_excel in databricks from /Filestore/tables/ directory?
您好我正在尝试读取从 UI 上传到 DBX 文件存储的 excel 文件。 我可以看到该文件在 /Filestore/tables 目录下可用,我正在尝试使用以下代码创建 pandas dataframe
import pandas as pd
df = pd.read_excel("/dbfs/FileStore/tables/abc.xlsx")
display(df)
我收到以下错误
FileNotFoundError:[Errno 2] 没有这样的文件或目录:'/dbfs/FileStore/tables/abc.xlsx
我知道该路径与我当前的工作目录无关我想知道如何使用 python 从文件存储中指向文件
我尝试过的事情:
我在路径中使用了 /FileStore/tables/abc.xlsx 但它不起作用
I know the scala code with spark-excel jar works but I cant execute scala commands as my org didn't and will not provide me access to execute scala commands.
任何想法如何让这个工作?
创建表时,该文件不存储为 excel 文件。 您可以通过Spark API访问数据。
如果您不想使用考拉,您也可以将表格读入考拉 dataframe,然后将其转换为 pandas。
如果您不想使用 Spark 或 koalas,则将文件上传到 /dbfs/FileStore 并从该位置的文件中使用 read_excel。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.