jepegit / cellpy

extract and tweak data from electrochemical tests of cells
MIT License
85 stars 31 forks source link

Cannot run example file: KeyError: 'Cycle_Index' #228

Closed kevinsmia1939 closed 1 year ago

kevinsmia1939 commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior.

python3 -mpip install cellpy
git clone git@github.com:jepegit/cellpy.git
sudo zypper in mdbtools
navigate to cellpy/examples/simple_reader_cellpy.py
run with Spyder 5.4.0
runfile('/home/andy/Desktop/software/cellpy/examples/simple_reader_cellpy.py', wdir='/home/andy/Desktop/software/cellpy/examples')
still alive so I guess all the needed modules are installed
/home/andy/Desktop/software/cellpy/examples

 -----------------------------------your files-----------------------------------
../testdata/data/20160805_test001_45_cc_01.res OK
../testdata/data/20160805_test001_45_cc_02.res OK
--------------------------------------------------------------------------------
             data_point      test_time  ... charge_c_rate  discharge_c_rate
cycle_index                             ...                                
1                  1457  168686.229691  ...          0.14              0.14
2                  2283  248276.169907  ...          0.14              0.14
3                  3119  329048.542626  ...          0.14              0.14
4                  3635  367369.238502  ...          0.28              0.28
5                  4133  404665.961044  ...          0.28              0.28

[5 rows x 29 columns]
Traceback (most recent call last):

  File /usr/lib64/python3.10/site-packages/pandas/core/indexes/base.py:3803 in get_loc
    return self._engine.get_loc(casted_key)

  File pandas/_libs/index.pyx:138 in pandas._libs.index.IndexEngine.get_loc

  File pandas/_libs/index.pyx:165 in pandas._libs.index.IndexEngine.get_loc

  File pandas/_libs/hashtable_class_helper.pxi:5745 in pandas._libs.hashtable.PyObjectHashTable.get_item

  File pandas/_libs/hashtable_class_helper.pxi:5753 in pandas._libs.hashtable.PyObjectHashTable.get_item

KeyError: 'Cycle_Index'

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

Traceback (most recent call last):

  File /usr/lib/python3.10/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File ~/Desktop/software/cellpy/examples/simple_reader_cellpy.py:54
    ax.plot(summary["Cycle_Index"], summary["Cumulated_Coulombic_Difference(mAh/g)"])

  File /usr/lib64/python3.10/site-packages/pandas/core/frame.py:3804 in __getitem__
    indexer = self.columns.get_loc(key)

  File /usr/lib64/python3.10/site-packages/pandas/core/indexes/base.py:3805 in get_loc
    raise KeyError(key) from err

KeyError: 'Cycle_Index'
kevinsmia1939 commented 1 year ago

Fixed https://github.com/jepegit/cellpy/pull/231