0

My data has a single column with rows like these : "148865220000000006 IMPACTED_NON_SERVICE_AFFECTING MAJOR 2017-03-04 23:59:46.3190 2017-03-05 00:00:44.8550 SERVICE 110999085 SERVICE NDE -1830810236"

I want to separate this into multiple columns delimited by tab. This task can be done in Excel using the "Text to Columns" option but due to the large size (1.46 GB), I am unable to open it in Excel.

Community
  • 1
  • 1
Shreyas
  • 419
  • 1
  • 5
  • 14

1 Answers1

0

If you want to do it quickly using the csv reader you should go to the above mentioned duplicate question. (Hint: use "delimiter")

In case you want to accomplish the task manually:

You can use the split() function in Python.

On your own example:

mystring = "148865220000000006 IMPACTED_NON_SERVICE_AFFECTING MAJOR 2017-03-04 23:59:46.3190 2017-03-05 00:00:44.8550 SERVICE 110999085 SERVICE NDE -1830810236"
mystring = mystring.split()
print(mystring)

This prints

 ['148865220000000006', 'IMPACTED_NON_SERVICE_AFFECTING', 'MAJOR', '2017-03-04', '23:59:46.3190', '2017-03-05', '00:00:44.8550', 'SERVICE', '110999085', 'SERVICE', 'NDE', '-1830810236']

Thus my string is now a list where the data have been split by space. You can use e.g split(",") to split comma separated values.

SiGm4
  • 284
  • 1
  • 2
  • 10