EXPAND ALL
  • Home

pluck_array

Convenience method to handle grabbing the ith item in an array from a serialized JSON string. The function parses the array JSON string and attempts to find the ith element. If the JSON string is not an array, or the index is out of range, an empty string is returned. This function returns the ith element as a string.

Returns: STRING

The value at the ith position in the array as a string.

Arguments

VariableTypeDescription
json_strSTRINGJSON data serialized as a string.
indexINT64The index of the value in the array.

Examples:

df.json = '{"names": ["foo", "bar"]}'
df.names = px.pluck(df.json, "names") # Returns ["foo", "bar"]
df.name0 = px.pluck_array(df.names, 0) # Returns "foo"
df.name5 = px.pluck_array(df.names, 5) # Returns ""
This site uses cookies to provide you with a better user experience. By using Pixie, you consent to our use of cookies.