Python Forum
Python outputs to Excel
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python outputs to Excel
#1
Hi,

I don't even know how to describe my problem but I'll try. I receive the same .txt file and my python code computes it and then outputs .csv. But this time I have a problem with my output, some of the column's data is too large and it goes over the next row, to my .csv files format is out of order.

E.G
Output:
Filename Clean vvs_000.txt From: this person > Sent: Wednesday s reviewed. Regards vvs_001.txt See this person I told you
The data in the Clean column is too late that "s reviewed. Regards" goes over to a new row.
Reply
#2
Have a look at the input file. There is no such thing as too long/large. There is a new line/carriage return in the input
Of course, without seeing your code, it's also possible that you add new line somehow
Unless you show sample input and your code it's hard to tell more
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
#3
Are you writing a lot of information to a single cell? There is a character limit on excel csvs per cell.
Reply
#4
Hi,
There are many reasons why things like that happen.
I usually encounter the reverse: problem: from excel going to csv.
What I do is perform some checks first.
1) Is every line terminated by a "\n", also the broken lines ?
2) If it is a csv, should there be the same number of separators "," on every line ? => count.
3) Is there something you can recognise the last element of a line with ?
4) Is the csv computer generated or did somebody type it manually?
etc...
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Outputs "NaN" after "DataFrame columns" function? epsilon 7 3,695 Jan-27-2021, 10:59 AM
Last Post: epsilon
  Comparing Values Resulting from Function Outputs firebird 0 1,815 Jul-25-2019, 05:16 AM
Last Post: firebird

Forum Jump:

User Panel Messages

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