Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error key 0 #3

Closed
tuxador opened this issue Dec 11, 2020 · 1 comment
Closed

error key 0 #3

tuxador opened this issue Dec 11, 2020 · 1 comment

Comments

@tuxador
Copy link

tuxador commented Dec 11, 2020

Hi, i'm trying to plot a CSV file obtained from an XML
my script is the following:

import ecg_plot
import pandas as pd
ecg = pd.read_csv('ecg_test.csv')
ecg_plot.plot(ecg,title = 'ECG test')
ecg_plot.show() 

and this is the error i've got:

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

   ecg_plot.plot(ecg,title = 'ECG test')
  File "/usr/lib/python3.9/site-packages/ecg_plot/ecg_plot.py", line 113, in plot
    secs  = len(ecg[0])/sample_rate
  File "/usr/lib/python3.9/site-packages/pandas/core/frame.py", line 2906, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/usr/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 2900, in get_loc
    raise KeyError(key) from err
KeyError: 0
`
@dy1901
Copy link
Owner

dy1901 commented Jan 10, 2021

Hi tuxador, ecg should be a numpy object in demension m x n, which m is lead count and n is length of signal. You should try to convert ecg from pandas to numpy

@dy1901 dy1901 closed this as completed Jan 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants