簡體   English   中英

熊貓申請排

[英]pandas apply for row

我在使用DataFrame.apply()函數時遇到問題。

我需要獲取行作為參數,但是它在每次調用中分別獲取每一行的元素。

數據框在這里

def parser(row):
  feature1 = row['feature1']

  """
  do some computations with feature1
  """

  feature = answer_from_previous_steps
  label = row['label']

  return [feature, label]

temp = df.apply(parser, axis=1)

問題解決了。 我在代碼中混淆了錯誤的日志

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM