Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attribute Error: list object has no attribute 'apply'

time_weight = list(100*np.exp(np.linspace(-1/divisor, -(num_steps-1)/divisor, num_steps))).apply(lambda x:int(x))

When I try this, I get the following error in Python 3.7.

AttributeError: 'list' object has no attribute 'apply'

Can anyone help with this?

like image 240
Anu Sachan Avatar asked May 02 '26 16:05

Anu Sachan


1 Answers

As the error said, list type has no apply attribute. This said, if you have a list l and you want to set to int type every element in it you may use:

l = [int(x) for x in l]

or

l = list(map(int,l))

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!