I have an excel spreadsheet as follows:
data = pd.read_excel(r'survey.xlsx')
Each row is a response to a survey, with columns being the different questions in Likert scale (Strong Agree, Mostly Agree, Neutral, Mostly Disagree, Strong Disagree).
Let's say that for a given question, the survey information in the excel spreadsheet can be printed as
print(data.iloc[:,9])
which gives
0 Mostly Agree
1 Mostly Agree
2 Mostly Disagree
3 Neither Agree Nor Disagree
4 Strongly Agree
I would like to use this package:
https://github.com/nmalkin/plot-likert
(or any other package for Likert scale)
to print a Likert graph (as in the repos showing) for all the survey questions.
I am specifically confused about this piece of code there which seems to do the work:
# Make sure you have some data
import pandas as pd
data = pd.DataFrame({'Q1': {0: 'Strongly disagree', 1: 'Agree', ...},
'Q2': {0: 'Disagree', 1: 'Strongly agree', ...}})
# Now plot it!
import plot_likert
plot_likert.plot_likert(data, plot_likert.scales.agree, plot_percentage=True);
and specifically, how to copy the data from the spreadsheet (which I also use Pandas for) into the "DataFrame". I am also not sure how to change 'Q1', 'Q2' in the Dataframe into the actual question, taking from the column header in the spreadsheet.
If any help could be given with that, I would greatly appreciate that.
My question is: given the spreadsheet in the above format (where several columns consist of questions, for example Column J asks "The movie was fun" with responses in each row with text "Strongly agree" etc.) how do I reformat it into a dataframe such as (where I can input the indices of the columns in the spread in a list list_questions = [9, 12, 17] etc):
data = pd.DataFrame({'Q1': {0: 'Strongly disagree', 1: 'Agree', ...},
'Q2': {0: 'Disagree', 1: 'Strongly agree', ...}})