
I need a python script that re-arranges a text file
- or -
Post a project like this1914
$40
- Posted:
- Proposals: 6
- Remote
- #2846685
- Awarded
PPH TOP 10 | Analytics Consultant | Data Scientist | Machine Learning Engineer
⭐ TOP RATED ⭐ Graphic Designer| WordPress / WIX | 3D Architecture | Video Editing |Photoshop Expert

Data Scientist| Python Developer|Machine Learning and AI Expert |Academic writer | Software Developer| GIS Expert| Website Development| Accounting and Bookkeeping|

247642333061744229865316202441194402726773





Description
Experience Level: Entry
Estimated project duration: 1 day or less
I need a python script capable of re-organizing a text file into a specific arrangement. I uploaded two text files below to show you what the raw text files look like and what the final text file should look like.
In the raw text file there are 4 columns of text, only pay attention to the first 2, you can ignore the last 2. The first columns represent time in seconds, and the second column represents the condition. 1 = the letter condition and 2 = the word condition.
In the final text file the goal is to group all the times corresponding to their associated condition together on one line, in a comma delineated format.
Each final txt documents needs to have the following in the first line:
condition_name,subject_number,session_number,onsets,durations,
The next two lines in the final text are for each condition. The first variable is condition name (either word or letter, the second variable is subject number (this is the first number in the text file title), the third variable is the session number (this is the second number in the title), the 4th number is all the onset times (please make sure that each time is separated by a space, not a comma), then the last variable is duration (this will always be a value of 2).
In the raw text file there are 4 columns of text, only pay attention to the first 2, you can ignore the last 2. The first columns represent time in seconds, and the second column represents the condition. 1 = the letter condition and 2 = the word condition.
In the final text file the goal is to group all the times corresponding to their associated condition together on one line, in a comma delineated format.
Each final txt documents needs to have the following in the first line:
condition_name,subject_number,session_number,onsets,durations,
The next two lines in the final text are for each condition. The first variable is condition name (either word or letter, the second variable is subject number (this is the first number in the text file title), the third variable is the session number (this is the second number in the title), the 4th number is all the onset times (please make sure that each time is separated by a space, not a comma), then the last variable is duration (this will always be a value of 2).

Post L.
100% (1)Projects Completed
1
Freelancers worked with
1
Projects awarded
100%
Last project
21 May 2020
Canada
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies