Skip to content

TypeError: control character 'delimiter' cannot be a newline #1166

@danial2008

Description

@danial2008

🐛 Bug Description

Traceback (most recent call last):
File "D:\dev\anaconda3\envs\qlib\lib\site-packages\IPython\core\interactiveshell.py", line 3398, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in <cell line: 1>
e.calendar(start_time='2010-01-01', end_time='2017-12-31', freq='day')
File "D:\dev\pyqlib\qlib\qlib\data\data.py", line 90, in calendar
_calendar, _calendar_index = self._get_calendar(freq, future)
File "D:\dev\pyqlib\qlib\qlib\data\data.py", line 171, in _get_calendar
_calendar = np.array(self.load_calendar(freq, future))
File "D:\dev\pyqlib\qlib\qlib\data\data.py", line 657, in load_calendar
backend_obj = self.backend_obj(freq=freq, future=future).data
File "D:\dev\pyqlib\qlib\qlib\data\storage\file_storage.py", line 129, in data
H["c"][key] = self._read_calendar()
File "D:\dev\pyqlib\qlib\qlib\data\storage\file_storage.py", line 111, in _read_calendar
for x in np.loadtxt(fp, str, skiprows=skip_rows, max_rows=n_rows, delimiter="\n", encoding="utf-8")
File "D:\dev\anaconda3\envs\qlib\lib\site-packages\numpy\lib\npyio.py", line 1301, in loadtxt
arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
File "D:\dev\anaconda3\envs\qlib\lib\site-packages\numpy\lib\npyio.py", line 1006, in _read
next_arr = _load_from_filelike(
TypeError: control character 'delimiter' cannot be a newline (\r or \n).

To Reproduce

Steps to reproduce the behavior:
1.download the data by get_data.py firstly
2.write a simple demo
qlib.init(provider_uri="D:/dev/pyqlib/data/cn_data/")

from qlib.data import D

D.calendar(start_time='2010-01-01', end_time='2017-12-31', freq='day')[:5]

Expected Behavior

Screenshot

Environment

Note: User could run cd scripts && python collect_info.py all under project directory to get system information
and paste them here directly.

  • Qlib version: 0.8.6
  • Python version: 3.8
  • OS (Windows, Linux, MacOS):Windows
  • Commit number (optional, please provide it if you are using the dev version):

Additional Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions