Python Forum
Converting .txt to .csv file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting .txt to .csv file
#17
(Jan-02-2021, 01:22 AM)SunWers Wrote: I could set the script up to be more automatic if the files were .csv format, correct?
It will be "automatic" all the same. Just the code will be slightly different, e.g. pandas.read_fwf vs pandas.read_csv or if you parse yourself it will allow to use csv, but in any case it will not do big difference.

Given that pandas did good job reading the file, concentrate on writing to excel. You have 2 options - write to excel from pandas using to_excel, then format the file to look like what you want using other package like openpyxl or write each column from the dataframe in the template you created one by one. In any case you need to handle start and end time because date and time are one column, while you want them separate columns.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
Converting .txt to .csv file - by SunWers - Jan-01-2021, 06:29 AM
RE: Converting .txt to .csv file - by palladium - Jan-01-2021, 06:52 AM
RE: Converting .txt to .csv file - by SunWers - Jan-01-2021, 07:31 AM
RE: Converting .txt to .csv file - by palladium - Jan-01-2021, 07:53 AM
RE: Converting .txt to .csv file - by SunWers - Jan-01-2021, 08:04 AM
RE: Converting .txt to .csv file - by buran - Jan-01-2021, 07:27 AM
RE: Converting .txt to .csv file - by SunWers - Jan-01-2021, 07:39 AM
RE: Converting .txt to .csv file - by buran - Jan-01-2021, 07:41 AM
RE: Converting .txt to .csv file - by SunWers - Jan-01-2021, 07:48 AM
RE: Converting .txt to .csv file - by palladium - Jan-01-2021, 07:56 AM
RE: Converting .txt to .csv file - by buran - Jan-01-2021, 07:54 AM
RE: Converting .txt to .csv file - by SunWers - Jan-01-2021, 07:56 AM
RE: Converting .txt to .csv file - by buran - Jan-01-2021, 08:39 AM
RE: Converting .txt to .csv file - by SunWers - Jan-02-2021, 01:22 AM
RE: Converting .txt to .csv file - by stevenroger - Jan-01-2021, 09:55 AM
RE: Converting .txt to .csv file - by buran - Jan-01-2021, 03:04 PM
RE: Converting .txt to .csv file - by buran - Jan-02-2021, 03:24 AM
RE: Converting .txt to .csv file - by Pedroski55 - Jan-02-2021, 05:03 AM
RE: Converting .txt to .csv file - by caleb_cruze - Jan-04-2021, 01:10 PM
RE: Converting .txt to .csv file - by buran - Jan-04-2021, 01:12 PM
RE: Converting .txt to .csv file - by pruthvi666 - Jan-19-2024, 10:36 AM
RE: Converting .txt to .csv file - by Larz60+ - Jan-20-2024, 10:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Converting a json file to a dataframe with rows and columns eyavuz21 13 4,860 Jan-29-2023, 03:59 PM
Last Post: eyavuz21
  [split] Help- converting file with pyton script eltomassito 6 3,351 Jul-02-2021, 05:29 PM
Last Post: snippsat
  Help- converting file with pyton script grinleon 3 2,546 Sep-23-2020, 11:48 AM
Last Post: grinleon

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020