没有值的列在使用 koalas read_excel() 读取 excel 到数据帧时给出错误 'can not infer schema'

Column having no values gives the error 'can not infer schema' while reading excel to dataframe using koalas read_excel()

当使用 databricks koalas read_excel() 将 excel 文件作为数据帧读取时,dtype 为 str,如果列没有值,它会给出错误

can not infer schema from empty dataset

如何解决这个问题? 如果我将 dtype 更改为 None,它不会抛出错误。但数值数据将以科学形式读取。

我试过编写转换器:

converters={i : (lambda x: str(x) if x or x!='' else np.NaN) for i in range(col_count)}

(dtype=str 不适用于转换器,因此已删除)。 但这会将字符串 'NA' 读取为 null。 我想要源文件中的数据。

问题在调用 [ 时通过参数 dtype=strna_filter = False 得到解决=19=]()