Pandas version checks

  • [X] I have checked that this issue has not already been reported.

  • [X] I have confirmed this bug exists on the latest version of pandas.

  • [X] I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

time_array = pd.date_range(start='2020-6-1 00:00:00', end='2021-10-31 00:00:00', freq='H')

Issue Description

I'm using pandas' date_range to generate datetime arrays:

time_array = pd.date_range(start='2020-6-1 00:00:00', end='2021-10-31 00:00:00', freq='H')

And when I start to debug my code, my IDE tells me this error:

past_predict_single.py::test_gen_line_model FAILED                       
past_predict_single.py:83 (test_gen_line_model)
def test_gen_line_model():
        back_hours = 72  
>       time_array = pd.date_range(start='2020-6-1 00:00:00', end='2021-10-31 00:00:00', freq='H')
E       TypeError: 'generator' object is not callable

But when I run my code, this error diappears.

And another interesting thing: after the error appeared on the 1st computer, I chose the 2nd computer to debug my code, but after running my code for several times, the 2nd computer also appeared this problem.

Expected Behavior

Solve the problem

Installed Versions

commit : 91111fd99898d9dcaa6bf6bedb662db4108da6e6 python : 3.10.6.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.22621 machine : AMD64 processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : Chinese (Simplified)_China.936 pandas : 1.5.1 numpy : 1.23.4 pytz : 2022.6 dateutil : 2.8.2 setuptools : 65.5.0 pip : 22.3 Cython : None pytest : 7.2.0 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : None pandas_datareader: None bs4 : None bottleneck : 1.3.5 brotli : fastparquet : None fsspec : 2022.10.0 gcsfs : None matplotlib : 3.5.3 numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyreadstat : None pyxlsb : None s3fs : None scipy : 1.9.3 snappy : None sqlalchemy : None tables : None tabulate : None xarray : 2022.10.0 xlrd : None xlwt : None zstandard : None tzdata : None

Comment From: vamsi-verma-s

Hi @forestbat, i'm unable to replicate this. The error may be coming from a different part of your code. can you provide full stack trace.

Comment From: forestbat

@vamsi-verma-s

2 = {traceback} <traceback object at 0x0000014656CD2900>
 tb_frame = {frame} test_gen_line_model [past_predict_single.py:86]  id:1401666378688
  stack = {list: 36} ['frame: test_gen_line_model [past_predict_single.py:86]  id:1401666378688', 'frame: pytest_pyfunc_call [python.py:195]  id:1401735341024', 'frame: _multicall [_callers.py:39]  id:1401664147920', 'frame: _hookexec [_manager.py:80]  id:1401735378128', 'frame: __call__ [_hooks.py:265]  id:1401735340544', 'frame: runtest [python.py:1789]  id:1401735388128', 'frame: pytest_runtest_call [runner.py:167]  id:1401735340064', 'frame: _multicall [_callers.py:39]  id:1401664144800', 'frame: _hookexec [_manager.py:80]  id:1401735376736', 'frame: __call__ [_hooks.py:265]  id:1401735339584', 'frame: <lambda> [runner.py:260]  id:1401735480224', 'frame: from_call [runner.py:339]  id:1401606849040', 'frame: call_runtest_hook [runner.py:259]  id:1401735337184', 'frame: call_and_report [runner.py:220]  id:1401735336704', 'frame: runtestprotocol [runner.py:131]  id:1401712033536', 'frame: pytest_runtest_protocol [runner.py:112]  id:1401735262080', 'frame: _multicall [_callers.py:39]  id:1401664137936', 'f...
   00 = {str} 'frame: test_gen_line_model [past_predict_single.py:86]  id:1401666378688'
   01 = {str} 'frame: pytest_pyfunc_call [python.py:195]  id:1401735341024'
   02 = {str} 'frame: _multicall [_callers.py:39]  id:1401664147920'
   03 = {str} 'frame: _hookexec [_manager.py:80]  id:1401735378128'
   04 = {str} 'frame: __call__ [_hooks.py:265]  id:1401735340544'
   05 = {str} 'frame: runtest [python.py:1789]  id:1401735388128'
   06 = {str} 'frame: pytest_runtest_call [runner.py:167]  id:1401735340064'
   07 = {str} 'frame: _multicall [_callers.py:39]  id:1401664144800'
   08 = {str} 'frame: _hookexec [_manager.py:80]  id:1401735376736'
   09 = {str} 'frame: __call__ [_hooks.py:265]  id:1401735339584'
   10 = {str} 'frame: <lambda> [runner.py:260]  id:1401735480224'
   11 = {str} 'frame: from_call [runner.py:339]  id:1401606849040'
   12 = {str} 'frame: call_runtest_hook [runner.py:259]  id:1401735337184'
   13 = {str} 'frame: call_and_report [runner.py:220]  id:1401735336704'
   14 = {str} 'frame: runtestprotocol [runner.py:131]  id:1401712033536'
   15 = {str} 'frame: pytest_runtest_protocol [runner.py:112]  id:1401735262080'
   16 = {str} 'frame: _multicall [_callers.py:39]  id:1401664137936'
   17 = {str} 'frame: _hookexec [_manager.py:80]  id:1401735369312'
   18 = {str} 'frame: __call__ [_hooks.py:265]  id:1401587037584'
   19 = {str} 'frame: pytest_runtestloop [main.py:349]  id:1401606883424'
   20 = {str} 'frame: _multicall [_callers.py:39]  id:1401664134816'
   21 = {str} 'frame: _hookexec [_manager.py:80]  id:1401735368848'
   22 = {str} 'frame: __call__ [_hooks.py:265]  id:1401735335264'
   23 = {str} 'frame: _main [main.py:324]  id:1401671867248'
   24 = {str} 'frame: wrap_session [main.py:270]  id:1401587269712'
   25 = {str} 'frame: pytest_cmdline_main [main.py:317]  id:1401672181568'
   26 = {str} 'frame: _multicall [_callers.py:39]  id:1401587036336'
   27 = {str} 'frame: _hookexec [_manager.py:80]  id:1401588468288'
   28 = {str} 'frame: __call__ [_hooks.py:265]  id:1401670609760'
   29 = {str} 'frame: main [__init__.py:167]  id:1401604356000'
   30 = {str} 'frame: <module> [_jb_pytest_runner.py:51]  id:1401616970464'
   31 = {str} 'frame: execfile [_pydev_execfile.py:18]  id:1401615593152'
   32 = {str} 'frame: _exec [pydevd.py:1496]  id:1401619579968'
   33 = {str} 'frame: run [pydevd.py:1489]  id:1401587023680'
   34 = {str} 'frame: main [pydevd.py:2177]  id:1401588461888'
   35 = {str} 'frame: <module> [pydevd.py:2195]  id:1401546120256'
   __len__ = {int} 36

Comment From: forestbat

I cut my code to another python file and the problem disappeared, if you hope me give more information, I will reopen the issue.