Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

KeyError: 0 #19

Description

@qwertyuu

While trying out this tool for the first time, by installing via pip install ds4ml, I tried a dataset we use at work in CSV format and I got this error running either data-pattern or data-synthesize

<__array_function__ internals>:5: RuntimeWarning: Converting input from bool to <class 'numpy.uint8'> for compatibility.
Traceback (most recent call last):
  File "/[redacted]/venv/lib/python3.8/site-packages/pandas/core/indexes/range.py", line 385, 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 "/[redacted]/venv/bin/data-pattern", line 8, in <module>
    sys.exit(main())
  File "/[redacted]/venv/lib/python3.8/site-packages/ds4ml/command/pattern.py", line 84, in main
    dataset.to_pattern(path=args.output, epsilon=args.epsilon, deletes=deletes,
  File "/[redacted]/venv/lib/python3.8/site-packages/ds4ml/dataset.py", line 207, in to_pattern
    network, cond_prs = self._construct_bayesian_network(
  File "/[redacted]/venv/lib/python3.8/site-packages/ds4ml/dataset.py", line 178, in _construct_bayesian_network
    self[col].type == 'string' and not self[col].categorical):
  File "/[redacted]/venv/lib/python3.8/site-packages/ds4ml/dataset.py", line 71, in __getitem__
    result.set_pattern(self._attrs.get(key),
  File "/[redacted]/venv/lib/python3.8/site-packages/ds4ml/attribute.py", line 135, in set_pattern
    self._calculate_pattern()
  File "/[redacted]/venv/lib/python3.8/site-packages/ds4ml/attribute.py", line 90, in _calculate_pattern
    self.fillna(self.mode()[0], inplace=True)
  File "/[redacted]/venv/lib/python3.8/site-packages/pandas/core/series.py", line 942, in __getitem__
    return self._get_value(key)
  File "/[redacted]l/venv/lib/python3.8/site-packages/pandas/core/series.py", line 1051, in _get_value
    loc = self.index.get_loc(label)
  File "/[redacted]/venv/lib/python3.8/site-packages/pandas/core/indexes/range.py", line 387, in get_loc
    raise KeyError(key) from err
KeyError: 0

Sadly, as you may know, I cannot provide you with the data I used to produce this error.

Please let me know if I can help you debug this, I would really like this to work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions