Skip to content

ValueError: 0 is not in range #4

@zhao-newname

Description

@zhao-newname

run the command "python3 run_first_time.py"

.......

984 sh.600917 重庆燃气
985 sh.600918 中泰证券
Traceback (most recent call last):
  File "/home/zjp/.local/lib/python3.8/site-packages/pandas/core/indexes/range.py", line 346, in get_loc
    return self._range.index(new_key)
ValueError: 0 is not in range

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "run_first_time.py", line 46, in <module>
    calculate_stock_spec.calculate_all_spec('sh', 'sh.000001')
  File "/home/zjp/workstaging/StockIndicatorAnalyzer/calculate_stock_spec.py", line 58, in calculate_all_spec
    daily['relaprice'] = daily['close']/daily['close'][0]
  File "/home/zjp/.local/lib/python3.8/site-packages/pandas/core/series.py", line 882, in __getitem__
    return self._get_value(key)
  File "/home/zjp/.local/lib/python3.8/site-packages/pandas/core/series.py", line 991, in _get_value
    loc = self.index.get_loc(label)
  File "/home/zjp/.local/lib/python3.8/site-packages/pandas/core/indexes/range.py", line 348, in get_loc
    raise KeyError(key) from err
KeyError: 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions