Python Forum
Likert survey data plot error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Likert survey data plot error
#4
You should post your code and not just link top SO as have to put this together.
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.
Reply


Messages In This Thread
Likert survey data plot error - by Andrzej_Andrzej - Jul-15-2023, 08:45 PM
RE: Likert survey data plot error - by snippsat - Jul-16-2023, 07:53 AM
RE: Likert survey data plot error - by snippsat - Jul-16-2023, 11:23 AM
RE: Likert survey data plot error - by snippsat - Jul-16-2023, 11:42 AM
RE: Likert survey data plot error - by deanhystad - Jul-16-2023, 10:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Value Error when Trying to Plot Filtered Waveforms mkohler 1 1,328 May-09-2024, 05:33 PM
Last Post: deanhystad
  Error when animating 3D plot Tee 4 2,226 Jul-03-2023, 08:49 PM
Last Post: Tee
  Plot a pandas data fram via pyqtgraph with an modul import and qt designer widget Nietzsche 0 1,500 May-29-2023, 02:42 PM
Last Post: Nietzsche
  Create simple live plot of stock data dram 2 3,822 Jan-27-2023, 04:34 AM
Last Post: CucumberNox
Thumbs Up Python 3 Jupyter notebook ternary plot data nicholas 0 1,819 Jan-21-2023, 05:01 PM
Last Post: nicholas
  pandas.errors.ParserError: Error tokenizing data. C error: Expected 9 fields in line Anldra12 9 21,778 Jun-15-2021, 08:16 AM
Last Post: Anldra12
  Plot data from CSV allen04 2 3,104 Jan-03-2021, 10:30 AM
Last Post: Axel_Erfurt
  How to plot intraday data of several days in one plot mistermister 3 3,949 Dec-15-2020, 07:43 PM
Last Post: deanhystad
  Creating Complex Color Spectrum Plot From Data JoeDainton123 2 2,818 Sep-15-2020, 08:09 AM
Last Post: DPaul
  How to plot data from live datasource? Makada 14 7,761 Sep-06-2020, 07:13 PM
Last Post: Makada

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020