Skip to content

Can a type convert a string to a dict or list? #1506

Answered by saulpw
davideaster asked this question in Q&A
Discussion options

You must be logged in to vote

Well, I tracked this down, and it's due to ExpandedColumn using the original columns' getValue instead of getTypedValue. This is because of the vlen type (z#), which can be applied to lists and dicts and strings, and converts the base value to an integer for sorting and a nicer display; this is used in the Frequency Sheet for the count, which is actually a list of the rows in the bin. Also you can meaningfully apply the str type (~) to get the Python string representation.

You could freeze the column (') after applying your jsonjson type, and then untype the frozen column (z~) but I think it's probably better to do =jsonjson(curcol) or make a command that does the same (and then probably …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@davideaster
Comment options

Answer selected by davideaster
Comment options

You must be logged in to vote
1 reply
@saulpw
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants