I’ll save a lot of code if I can use a server module like this to return an array of unique column contents from a media object transformed into a pandas df. I want to pass the column name to the server function and have it return an array of that column’s unique values: file=app_tables.files.get(filetype=‘MARSYS’)
THIS definitely does not work, but I think it conveys the concept. I want to build a string ‘ask’ but use the value of that variable as the pd.series query:
def get_column(col):
df=pd.read_csv(io.BytesIO(file.get_bytes()), names=["industry", "top_level", "category"])
ask = "df." + col + ".unique()"
array = pd.Series($ask)