[Python] Order some data with python

Discussão em 'Python' iniciado por Stack, Setembro 13, 2024.

  1. Stack

    Stack Membro Participativo

    I have some data in a csv file and i want to make in a specific order based on two columns. each row represent an answer of a user.

    and i want to order it using python based of (question_type + length_string) for each iduser (i have 20 rows by user) and here is the order :

    [
    {'length_string': 5, 'question_type': 'baseline'},
    {'length_string': 15, 'question_type': 'baseline'},
    {'length_string': 5, 'question_type': 'baseline'},
    {'length_string': 10, 'question_type': 'baseline'},
    {'length_string': 15, 'question_type': 'baseline'},
    {'length_string': 15, 'question_type': 'baseline'},
    {'length_string': 5, 'question_type': 'side_by_side_color'},
    {'length_string': 15, 'question_type': 'side_by_side_color'},
    {'length_string': 5, 'question_type': 'Top_of_each_color'},
    {'length_string': 10, 'question_type': 'Top_of_each_color'},
    {'length_string': 15, 'question_type': 'Top_of_each_color'},
    {'length_string': 15, 'question_type': 'side_by_side_color'},
    {'length_string': 'paragraph', 'question_type': 'side_by_side_baseline'},
    {'length_string': 'paragraph', 'question_type': 'side_by_side_color'},
    {'length_string': 'paragraph', 'question_type': 'side_by_side_color'},
    {'length_string': 10, 'question_type': 'Top_of_each_baseline'},
    {'length_string': 10, 'question_type': 'Top_of_each_color'},
    {'length_string': 15, 'question_type': 'side_by_side_color'},
    {'length_string': 'paragraph', 'question_type': 'side_by_side_baseline'},
    {'length_string': 5, 'question_type': 'side_by_side_baseline'}
    ]


    Please if any one could help me do that.

    Note : if you can do that just using excel. Please send me the output you get, but it's preferable for me to have it with python.

    Continue reading...

Compartilhe esta Página