Comments (24)
Thanks; it appears the problem was that missing values in the lss wasn’t handled correctly. I’ve updated the code; hopefully this solves the problem
from limepy.
I do get the same error message using your csv... It appears to have something to do with identical question codes. I have made a small change, it appears to work now, though I’d recommend checking if you get correct results. Or better, changing question codes to make them unique :)
from limepy.
Hi, thanks for your feedback. The code looks ok, It’s not immediately clear to me what might have gone wrong. Perhaps if you could share the lss file I could try to figure out what caused the bug?
from limepy.
Hi, here is my lss
file : https://drop.infini.fr/r/4CJ389qS1C#RJ2n/6rSFe6fECUkoljtYWTwIDVzDtQZwkruPqybTxw=
Thanks for your help.
from limepy.
It works! Thanks!
from limepy.
I am now able to create a Survey object, but I encounter some other problems:
my_survey.respondent(10)
raises an error:
File "/home/xxxxxx/anaconda3/lib/python3.9/site-packages/limepy/wrangle.py", line 326, in respondent
respondent += question['question'] + '\n'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
I wonder if this is not linked to previous bug.
my_question = Question(my_survey, 193659)
also produces an error:
KeyError: 'matiere[SQ001]'
Maybe this is due to the fact that this question was a table?
from limepy.
Hi, it appears to have something to do with how Limesurvey generates column names from question and subquestion codes. For example, your csv has a column named matiere_SQ001
; if I export the data from my own installation of Limesurvey, I get matiere[SQ001]
. I’m not sure whether this is because your version is older or newer; which version of Limesurvey are you using?
from limepy.
which version of Limesurvey are you using?
Version 2.65.0+170502 (a bit old, I'm afraid
from limepy.
Thanks; I guess that might explain it :)
Do you think it would be possible to upgrade? I was able to import your lss file into 5.3 so you should still be able to use the survey you created
from limepy.
EDIT : I'm able to affect this column name with an option: if I put "Use Expression Manager code:" to "On" I get matiere_SQ001
. Otherwise I obtain matiere[SQ001]
like you.
What is the best setting?
Do you think it would be possible to upgrade?
Unfortunately I use an institutional install.
from limepy.
Ah, I see, I never paid attention to that setting (in my version it's called Use ExpressionScript code
). Yes could you try exporting with that setting set to Off
and see if that works?
from limepy.
There’s another thing that might create problems: it appears your survey has questions with identical question codes, in which case pandas will add a suffix to differentiate them, for example matiere_SQ001.1
from limepy.
Here are the settings I have used:
And here are some lines of the resulting csv
:
"id","submitdate","lastpage","startlanguage","startdate","datestamp","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","matiere[SQ001]","matiere[SQ002]","matiere[SQ003]","matiere[SQ004]","matiere[SQ005]","matiere[SQ006]","suggestion","general[SQ001]","general[SQ002]","general[SQ003]","general[SQ004]","general[SQ005]","ptspositifs[SQ001_SQ001]","ptspositifs[SQ002_SQ001]","ptspositifs[SQ003_SQ001]","ptsnegatifs[SQ001_SQ001]","ptsnegatifs[SQ002_SQ001]","ptsnegatifs[SQ003_SQ001]","commentaire","poisson"
"10","2022-04-01 07:55:43","17","fr","2022-04-01 07:38:41","2022-04-01 07:55:43","Plutôt d'accord","Plutôt pas d'accord","Tout à fait d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","+ d'applications en cinématiques ","Plutôt d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","DS parfois trop long","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","","Plutôt d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","","Plutôt d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","","Plutôt d'accord","Plutôt d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","","Plutôt d'accord","Tout à fait d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","","Tout à fait d'accord","Tout à fait d'accord","Plutôt d'accord","Tout à fait d'accord","Tout à fait d'accord","Plutôt d'accord","","Plutôt d'accord","Plutôt d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","","Plutôt d'accord","Plutôt d'accord","Tout à fait d'accord","Tout à fait d'accord","Plutôt d'accord","Tout à fait d'accord","","Tout à fait d'accord","Plutôt d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Plutôt d'accord","","Plutôt d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","","Plutôt d'accord","Plutôt pas d'accord","Pas du tout d'accord","Pas du tout d'accord","Plutôt d'accord","Plutôt d'accord","Rendre les cours plus concrets","Tout à fait d'accord","Plutôt d'accord","Plutôt d'accord","Tout à fait d'accord","Tout à fait d'accord","Professionalisation ","Bonne ambiance ","Échelle humaine","","","","","Bonne idée ! "
"11","2022-04-01 07:49:16","17","fr","2022-04-01 07:38:42","2022-04-01 07:49:16","Plutôt d'accord","Plutôt d'accord","Pas du tout d'accord","Pas du tout d'accord","Pas du tout d'accord","Pas du tout d'accord","Problème de compréhension avec le prof ","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","","Plutôt d'accord","Tout à fait d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt pas d'accord","Plutôt d'accord","","Plutôt d'accord","Plutôt d'accord","Plutôt pas d'accord","Plutôt pas d'accord","Plutôt d'accord","Plutôt d'accord","","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","","Plutôt d'accord","Plutôt d'accord","Plutôt pas d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","","Plutôt pas d'accord","Plutôt pas d'accord","Plutôt pas d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","Plutôt d'accord","","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Tout à fait d'accord","Plutôt pas d'accord","Le niveau ","L'ambiance ","Soirée ","Le contenu","Certains profs ","Horaire ","","C'est une bonne idée "
As in my first post, the command my_survey = Survey(df, my_structure)
raises the following error:
File "/home/xxxxxx/anaconda3/lib/python3.9/site-packages/limepy/wrangle.py", line 264, in create_readable_df
colname = colname.replace('\n', ' ')
AttributeError: 'NoneType' object has no attribute 'replace'
it appears your survey has questions with identical question codes
yes I noticed that... in Limesurvey they are in separated groups of questions but the export seems to ignore it... That's strange.
from limepy.
But if you're not able to reproduce the bug, I will assume this is due to my old version of Limesurvey and I will use another strategy, nevermind.
from limepy.
It seems to work, so far. Thanks!
from limepy.
Sorry to disturb you again: I think there still is a bug (maybe I should open another issue, I don't know if it's related to previous ones) :
When I ask my_question = Question(my_survey, 193659)
, the array corresponding to
my_question.summary.values
contains only zeroes. I observe the same with other similar questions.
from limepy.
Hi, the problem seems to be in how the answers are exported. Do you have an option to export answer codes (or something similar)? If so, could you try if that works?
from limepy.
That's it! Thank you! Sorry, I see it was written in the Readme, though.
from limepy.
Thanks, I’ll fix it in the Readme!
from limepy.
Incidentally, I’m still a bit concerned that duplicate question codes may lead to problems further down the line, since Limesurvey creates column names from (sub-) question codes, and duplicate column names will create problems when looking up the correct answers to a question
from limepy.
OK you're right: all the questions get the same values as the first one. I will make the question code unique.
from limepy.
Ok, hope that works!
from limepy.
It's OK now. Fortunately Limesurvey allows to edit question codes even if the survey has already been activated. Thank you very much for this great library and for your help!
from limepy.
Good to hear, & thanks for the feedback!
from limepy.
Related Issues (20)
- Changes due to manual editing of LimeSurvey responses HOT 1
- Problem with single-language surveys
- KeyError while loading question HOT 5
- License HOT 1
- Is it possible to read a LSS file without having a dataframe of answers? HOT 4
- user_id unclear in documentation HOT 5
- Encoding issues HOT 3
- Getting a KeyError: 'help' when creating survey object HOT 4
- some open ended questions are just empty HOT 6
- Unable to use Plugin for authentication HOT 2
- Check for presence of elements in lss survey structure HOT 1
- Unable to use different plugin URL for base url
- Did not work out of apache (deafult nginx or IIS) HOT 1
- `TypeError: string indices must be integers` in wrangle.py HOT 4
- download.get_responses(base_url, user_name, password, user_id, sid) error HOT 10
- AttributeError: 'dict' object has no attribute 'encode' HOT 3
- Changes in data structure in LimeSurvey 4
- No way to get question code from Question object? HOT 4
- Survey in multiple languages HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from limepy.