-1

whenever I try to use len function in my code I get this error ?

long_trade={}
short_trade={}
long_trade['total_long']=get_total_long(long_df,len(long_df))
short_trade['total_short']=get_total_short(short_df,len(short_df))

print(short_trade)
print(long_trade) 

Error

> TypeError                                 Traceback (most recent call
> last) <ipython-input-37-619a2cc53415> in <module>()
>       2 long_trade={}
>       3 short_trade={}
> ----> 4 long_trade['total_long']=get_total_long(long_df,len(long_df))
>       5 short_trade['total_short']=get_total_short(short_df,len(short_df))
>       6 
> 
> TypeError: 'numpy.int64' object is not callable
Vishal Naik
  • 134
  • 12
  • You're going to have to provide more code for us to be able to reproduce or solve your problem. But from the look of it, it looks like you named a variable `len` somewhere. – forthe Oct 05 '20 at 00:38
  • Please provide the expected [MRE](https://stackoverflow.com/help/minimal-reproducible-example). Show where the intermediate results deviate from the ones you expect. We should be able to paste a single block of your code into file, run it, and reproduce your problem. – Prune Oct 05 '20 at 00:45
  • Sorry I cannot reproduce some part of the code. Due to Non-disclosure – Vishal Naik Oct 05 '20 at 03:18

1 Answers1

2

One between get_total_long or len has been accidentally assigned to an integer, whether you think they should both be functions, hence you are calling them (by using parenthesis)

It's very likely that in your code you have somewhere a line like this:

len = some expression which returns a numpy.int64

or

get_total_long = some expression which returns a numpy.int64

gioxc88
  • 349
  • 1
  • 9