【问题标题】:code containing .iloc not working with Koalas dataframe包含 .iloc 的代码不适用于 Koalas 数据框
【发布时间】:2020-09-26 04:56:00
【问题描述】:
koalas_img = ks.read_spark_io(path="/mnt/databricks/demo/CarClassification/cars_train/009*.jpg", format="binaryfile")
koalas_img.shape
Out[16]: (100, 4)
type(koalas_img)
Out[17]: databricks.koalas.frame.DataFrame
koalas_img.columns
Out[18]: Index(['path', 'modificationTime', 'length', 'content'], dtype='object')
koalas_img.iloc[0]
SparkPandasNotImplementedError: .iloc requires numeric slice or conditional boolean Index, got [0] You are trying to use pandas function .iloc[..., ...], use spark function select, where

根据https://databricks.com/notebooks/cnn-car-class/koalas-augmentation.html 中的文档 iloc 函数可以与 koalas 数据框一起使用。

【问题讨论】:

  • 嗨@nimit Kothari,如果我的回答对您有帮助,您可以接受它作为答案(单击答案旁边的复选标记将其从灰色切换为已填充。)。这对其他社区成员可能是有益的。谢谢。

标签: python pyspark apache-spark-sql databricks spark-koalas


【解决方案1】:

确保已安装所有 Python (PyPi) 依赖项。

%sh

pip install opencv-python-headless

pip install Keras

pip install tensorflow

pip install koalas

pip install h5py

pip install Pillow

我能够成功运行笔记本(koalas-augmentation)单元,没有任何问题。

【讨论】:

    猜你喜欢
    • 2011-10-26
    • 1970-01-01
    • 2017-10-06
    • 1970-01-01
    • 1970-01-01
    • 2017-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多