How to Convert multiple sets of Data going from left to right to top to bottom the Pythonic way?

Posted by ThinkCode on Stack Overflow See other posts from Stack Overflow or by ThinkCode
Published on 2011-02-22T22:44:19Z Indexed on 2011/02/22 23:25 UTC
Read the original article Hit count: 413

Filed under:
|
|
|

Following is a sample of sets of contacts for each company going from left to right.

ID Company ContactFirst1 ContactLast1 Title1 Email1     ContactFirst2 ContactLast2 Title2 Email2
1  ABC     John          Doe          CEO    [email protected] Steve         Bern         CIO    [email protected]

How do I get them to go top to bottom as shown?

ID Company Contactfirst ContactLast Title Email
1  ABC     John         Doe         CEO   [email protected]
1  ABC     Steve        Bern        CIO   [email protected]

I am hoping there is a Pythonic way of solving this task. Any pointers or samples are really appreciated!

p.s : In the actual file, there are 10 sets of contacts going from left to right and there are few thousand such records. It is a CSV file and I loaded into MySQL to manipulate the data.

© Stack Overflow or respective owner

Related posts about python

Related posts about data-structures