Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93045
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!gordon |
|---|---|
| From | John Gordon <gordon@panix.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: To write headers once with different values in separate row in CSV |
| Date | Tue, 23 Jun 2015 19:12:28 +0000 (UTC) |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 25 |
| Message-ID | <mmcb2s$dcm$1@reader1.panix.com> (permalink) |
| References | <c0ea6bec-b6b1-48fd-9291-0fedcda7b76c@googlegroups.com> |
| NNTP-Posting-Host | panix3.panix.com |
| X-Trace | reader1.panix.com 1435086748 13718 166.84.1.3 (23 Jun 2015 19:12:28 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Tue, 23 Jun 2015 19:12:28 +0000 (UTC) |
| User-Agent | nn/6.7.3 |
| Xref | csiph.com comp.lang.python:93045 |
Show key headers only | View raw
In <c0ea6bec-b6b1-48fd-9291-0fedcda7b76c@googlegroups.com> Sahlusar <ahlusar.ahluwalia@gmail.com> writes:
> However, when I extrapolate this same logic with a list like:
> ('Response.MemberO.PMembers.PMembers.Member.CurrentEmployer.EmployerAddress
> .TimeAtPreviousAddress.', None), where the headers/columns are the first
> item (only to be written out once) with different values. I receive an
> output CSV with repeating headers and values all printed in one long string
First, I would try to determine if the problem is in the makerows()
function, or if the problem is elsewhere.
Have you tried creating some dummy data by hand and seeing how makerows()
handles it?
(By the way, if your post had included some sample data that illustrates
the problem, it would have been much easier to figure out a solution.
Instead, we are left guessing at your XML format, and at the particular
implementation of flatten_dict().)
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
To write headers once with different values in separate row in CSV Sahlusar <ahlusar.ahluwalia@gmail.com> - 2015-06-23 10:15 -0700
Re: To write headers once with different values in separate row in CSV John Gordon <gordon@panix.com> - 2015-06-23 19:12 +0000
Re: To write headers once with different values in separate row in CSV kbtyo <ahlusar.ahluwalia@gmail.com> - 2015-06-24 04:31 -0700
Re: To write headers once with different values in separate row in CSV Steven D'Aprano <steve@pearwood.info> - 2015-06-24 11:50 +1000
Re: To write headers once with different values in separate row in CSV kbtyo <ahlusar.ahluwalia@gmail.com> - 2015-06-24 04:37 -0700
Re: To write headers once with different values in separate row in CSV Steven D'Aprano <steve@pearwood.info> - 2015-06-24 22:38 +1000
Re: To write headers once with different values in separate row in CSV kbtyo <ahlusar.ahluwalia@gmail.com> - 2015-06-24 05:52 -0700
Re: To write headers once with different values in separate row in CSV kbtyo <ahlusar.ahluwalia@gmail.com> - 2015-06-25 09:37 -0700
csiph-web