How to subset/select properties from an object set?

I am trying to create a function that takes in an object set and returns a subset of the object set by choosing one property. I need to use a function since I need this to be dynamic for my visualizations. Is there no select ability? It seems like a relatively straight forward thing but I come from a class data science background, very new in palantir.

Where are you making this visualization? What type of function are you writing (python, TSv2, TS)?

Can you share some more details around the use case

Of course! I was trying in python but I’m open to typescript if it can handle the job better.

for the visualization - I am in Workshop, trying to make a choropleth map and change what variable the choropleth is colored by. All the variables are in an object set, and I want to have a drop-down that chooses the variable. I have 80+ variables which is why I’m needing a dynamic solution.

In TSv2 you can do something like this (this is not supported inTSv1). I am not sure if it is supported in python.

client(<objectType>).where(...
)
.fetchPage({
    $select: ["property1", "property2"]
    $pageSize: 1
  })

Depending on how exactly you are grouping your data, it might make sense to leverage the aggregation ability of the ontology to more easily get what you are looking for.

Thank you! Unfortunately I need the functions output to be an object set directly to get it to work in the map; fetchPage doesn’t return an object set.

If you need to return an object set then selecting properties is unnecessary / won’t be any more performant. The selection will only help when you try to actually materialize the object set into a list of objects.