New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split cell into new rows, not just new columns. #386
Comments
Hi @hexatonic, Apologies for the slow reply, just back from conferences. I think this is a nice idea, very happy to review a PR. I'd suggest a new function called something like "splitdown" or "splitmany" Function signature something like: def splitdown(table, field, pattern, maxsplit=0, flags=0) If you look at the source of the petl.transform.regex module you'll see the In this case you want a row iterator function something like (untested): def itersplitdown(source, field, pattern, maxsplit, flags):
index')
range(len(hdr))) Hope that's comprehensible! Obviously a unit test would be very nice too. Cheers, On Thursday, September 8, 2016, Hexatonic notifications@github.com wrote:
Alistair Miles |
Hi @alimanfoo, Thanks, |
Hi @hexatonics, Thanks, |
I propose a feature that would allow the use of regex to split a fields into new rows. Currently, it's only possible to create new columns afaik, which causes a potential problem when the split yields different numbers of new data elements for every case. Simple Example:
Desired Result:
I'd be happy to give it a try if it doesn't already exist. Looking for suggestion on how to implement, but I imagine it as some type of parameter you could pass to the split method.
The text was updated successfully, but these errors were encountered: