Trouble passing in lambda to apply for pandas DataFrame

前端 未结 1 349
悲&欢浪女
悲&欢浪女 2021-02-06 21:34

I\'m trying to apply a function to all rows of a pandas DataFrame (actually just one column in that DataFrame)

I\'m sure this is a syntax error but I\'m know sure what I

1条回答
  •  执念已碎
    2021-02-06 21:57

    Note there is no axis param for a Series.apply call, as distinct to a DataFrame.apply call.

    Series.apply(func, convert_dtype=True, args=(), **kwds)

    func : function
    convert_dtype : boolean, default True
    Try to find better dtype for elementwise function results. If False, leave as dtype=object
    args : tuple
    Positional arguments to pass to function in addition to the value
    

    There is one for a df but it's unclear how you're expecting this to work when you're calling it on a series but you're expecting it to work on a row?

    0 讨论(0)
提交回复
热议问题