Jul-16-2023, 11:23 AM
You should post your code and not just link top SO as have to put this together.
Something like this.
Eg for me
You could submit this as a issue,then it maybe will be fixed if Repo still active.
Something like this.
import pandas as pd pd.set_option('display.expand_frame_repr', False) data = { "ID": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "Q1": [ "no answer", "Very satisfied", "no answer", "no answer", "Very satisfied", "no answer", "no answer", "Very satisfied", "Very satisfied", "no answer", "no answer", "Neither satisfied nor dissatisfied", "no answer", "Very satisfied", "Neither satisfied nor dissatisfied", "Somewhat satisfied", ], "Q2": [ "no answer", "Very satisfied", "no answer", "no answer", "Very satisfied", "no answer", "no answer", "Very satisfied", "Very satisfied", "no answer", "no answer", "Somewhat satisfied", "no answer", "Very satisfied", "Somewhat dissatisfied", "Neither satisfied nor dissatisfied", ], "Q3": [ "no answer", "no answer", "no answer", "no answer", "no answer", "no answer", "no answer", "no answer", "no answer", "no answer", "no answer", "no answer", "no answer", "Neither satisfied nor dissatisfied", "no answer", "Somewhat satisfied", ] } df = pd.DataFrame(data) df = pd.concat([df[c].value_counts() for c in df.columns],axis=1).fillna(0) df1 = df.reset_index() df1.columns = ['Answer', 'Del', 'Q1', 'Q2', 'Q3'] df1.drop('Del', inplace=True, axis=1) result = df1.iloc[16:] print(result)
Output: Answer Q1 Q2 Q3
16 no answer 8.0 8.0 14.0
17 Very satisfied 5.0 5.0 0.0
18 Neither satisfied nor dissatisfied 2.0 1.0 1.0
19 Somewhat satisfied 1.0 1.0 1.0
20 Somewhat dissatisfied 0.0 1.0 0.0
Quote:Thank you very much, as I have been struggling with it for a few hours. This is not yet my level to change the code inside a functions.It not a function change,you change source code of plot_likert.
Eg for me
C:\Python311\Lib\site-packages\plot_likert\plot_likert.py
open file plot_likert.py
go to line 251 and change as i describe.You could submit this as a issue,then it maybe will be fixed if Repo still active.