I have one function that takes three arguments. And here's the heading.
def count_ones(num, total_bits, group_size):
And I am trying to apply this function to data column. But it is not returning what I expected. Could anyone help me out on this problem? total_bits are 60 and group_size is 12.
df['events'] = df['data'].apply(count_ones, args =(60, 12))
Pass the arguments as kwargs to apply
:
df['events'] = df['data'].apply(count_ones, total_bits=60, group_size=12)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With