Unpivoting with regex
See original GitHub issueHow would I unpivot the following table using regex:
2000,2001,2002
a1,b1,c1,d1
a2,b2,c2,d2
I’d call unpivot
like below:
unpivoting_fields = [
{'name': r'\d{4}', 'keys': {'year': r'\d{4}'}}
]
extra_keys = [
{'name': 'year', 'type': 'year'}
]
extra_value = {'name': 'value', 'type': 'string'}
unpivot(unpivoting_fields, extra_keys, extra_value)
but this results to:
year,value
\\d{4},a1
\\d{4},a2
\\d{4},b1
...
am I missing something?
Once we figure it out, I will update the docs as it would be great to have an example for this one 😄
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How to write regex in Knime Unpivoting node to select columns
I am attempting to unpivot COVID-19 data in Knime with the Unpivoting Node. ... The Unpivoting Node has an option to use Regex...
Read more >Intra-field list pivot and unpivot - Bob Jankovsky
following unpivot task appears: One record with coma separated values in a column causes creating several rows, one for each part of the...
Read more >Understanding PIVOT, UNPIVOT, and Reverse ... - {coding}Sight
Reversing a PIVOT statement refers to the process of applying the UNPIVOT operator to the ... T-SQL Regular expression: LIKE Operator and its...
Read more >Help with TSQL and Regular Expressions - SQLServerCentral
I have the following code that I'm trying to implement. I have a successful solution using SQL CLR but the project team consensus...
Read more >unpivot does not work if tagpass is set · Issue #8044 - GitHub
The fields in the cpu measurement should be unpivoted, i.e., there should be a new measurement for each field, tagged with the field...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, I missed that @zelima had the fix and this was just open still for documentation. In any case, that is another example.
I have a guess why your regex may have failed. When I used this in dataflows I used group () in the names and then was able to use \1 \2 etc in the keys to so it would have the resulting matches.
Instead of:
Try something like this:
Here is an example from when I did this in dataflows:
I used the regex to great effect transforming columns with station and depth in the column names.
to:
and in the flow this is my unpivot: