【问题标题】:Writing Custom Data frames to from pyspark to Azure Event Hub将自定义数据帧从 pyspark 写入 Azure 事件中心
【发布时间】:2019-09-25 14:17:03
【问题描述】:

尝试将自定义 Pandas 数据框添加到 Azure 事件中心。代码如下:

  dic = { 
           'body' : filter_data
    }
    df = pd.DataFrame(dic,index=[0])
    df1 = df.astype(str)
    ds = df1 \
        .select('body') \
  .write \
  .format("eventhubs") \
  .options(**ehEventConf) \
  .option("checkpointLocation", "output") \
  .save()

我收到类似"TypeError: 'str' object is not callable"的错误

【问题讨论】:

    标签: python pandas pyspark azure-eventhub


    【解决方案1】:

    如上面的错误中所述,.select('body') 在 str 对象 (df1) 上被调用,这是不受支持的。该函数需要一个数据框(类似 sql 的对象)。请尝试 df.select('body')..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-10-06
      • 2018-06-24
      • 2020-11-26
      • 1970-01-01
      • 1970-01-01
      • 2023-04-11
      • 1970-01-01
      相关资源
      最近更新 更多