Skip to content

likertScalePlot.py is not Running #3

@filipedwan

Description

@filipedwan

The script is not running. Following the error:


KeyError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2601 try:
-> 2602 return self._engine.get_loc(key)
2603 except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: None

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)
in
----> 1 likert_scale(dummy)

~/Documentos/Exemplo Likert PLot/likertScalePlot-master/likertscaleplot/likertScalePlot.py in likert_scale(df, ax, normalise, labels, middle_line, legend, rotation, title_plot, rounding, font_size)
265 # Get the sum of the middles +.5 if middle value and without .5 if splitted in 2
266 # equal divides
--> 267 middles = get_total_mid_answers(df)
268
269 # Calculate the longest middle bar to set up the middle of the x-axis for the x-lables

~/Documentos/Exemplo Likert PLot/likertScalePlot-master/likertscaleplot/likertScalePlot.py in get_total_mid_answers(df)
154 """
155 middle, first_half = get_middle(df.columns)
--> 156 return compute_middle_sum(df, first_half, middle)
157
158

~/Documentos/Exemplo Likert PLot/likertScalePlot-master/likertscaleplot/likertScalePlot.py in compute_middle_sum(df, first_half, middle)
118 def compute_middle_sum(df, first_half, middle):
119 try:
--> 120 return df[first_half].sum(axis=1) + df[middle] *.5
121 except ValueError: # In case middle value is none
122 return df[first_half].sum(axis=1)

~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in getitem(self, key)
2915 if self.columns.nlevels > 1:
2916 return self._getitem_multilevel(key)
-> 2917 indexer = self.columns.get_loc(key)
2918 if is_integer(indexer):
2919 indexer = [indexer]

~/anaconda3/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2602 return self._engine.get_loc(key)
2603 except KeyError:
-> 2604 return self._engine.get_loc(self._maybe_cast_indexer(key))
2605 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2606 if indexer.ndim > 1 or indexer.size > 1:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: None

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