Closed rbyh closed 2 weeks ago
Need to think of how to handle potential additional columns that may or may not also be used, eg respondent ids.
This may make the most sense to build as Conjure methods, however, there could be other types of scenarios that a user may want to construct in this way that are not survey responses.
What I think we really want here is some optional parameters in from_ScenarioList that let you skip rows, re-name, come up with automatic valid indentifiers and so on. Right now, there's very little: https://github.com/expectedparrot/edsl/blob/88448ddbd6af402a605893e877e6dc8c57fec047/edsl/scenarios/ScenarioList.py#L693
@rbyh want to give some examples in a NB with CSVs you'd like to do something different with and maybe some proposed syntax?
This is covered in new ScenarioList
method unpivot
.
Say I want to import a CSV of survey responses but use the header row (of question texts) as scenarios in addition to / paired with scenarios for the responses. Existing method
ScenarioList.from_csv()
will automatically use the header row as the scenario keys, which is not desired (and also creates a formatting issue where keys are sentences).It would be convenient to have a method / option for transforming scenarios that have been auto-generated in this way -- i.e., a way of specifying that (1) the original keys should become values for a new key and (2) the original values should be assigned a new key. The new keys would be identical across the values, by default, e.g., "question" and "response":