Last active
May 12, 2020 00:07
-
-
Save mcampos-quinn/94b3b10796110043a45b2163156e7d81 to your computer and use it in GitHub Desktop.
recipes and stuff for openrefine, grel expressions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################ | |
Transform cells containing a single name in `Fn Mn Ln` format into `Ln, Fn Mn` | |
value.split(/ (?=[^ ]*$)/).reverse().join(", ") | |
the split regex catches the last " " space that occurs and takes the characters after it as the last name, | |
then moves it to the front and joins the values with comma-space. | |
To perform this transformation, at the top of a column, go to Edit Cells> Transform and paste the expression into the box. | |
#################### | |
#################### | |
JYTHON | |
Transform cells from pipe-delimited to python-list-like | |
Jane Doe|John Doe --> ["Jane Doe","John Doe"] | |
value = value.encode('latin-1') | |
x = '["{}"]'.format(value.replace("|",'","')) | |
return x | |
#################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment