Going through my first experiences with (In)flux and so far a pretty exciting journey! However, coming from Python/Pandas background, I am struggling to find equivalent functionality in Flux sometimes. One of the examples is: pivot -> fill NA -> sum (or any other agg function) across columns. This is a very common and typical use case in time series analysis, but I cannot achieve that for time series with dynamic tags. Imagine you observe time series with previously_unknown/randomly_generated tags (say, your arriving customers for concreteness) and you would like to aggregate a metric you observe. In Pandas you would pivot your dataframe, fill NA’s (since customers may arrive irregularly), and do sum (or whatever metric) with axis=1. In this way, one does not need to deal explicitly with customer tags at all, but I cannot find a way to do that in Flux, so any help much appreciated!
Have you tried show tag keys
?
Edit: sorry I missed that you are using flux. I think columns()
is meant to be the equivalent
Thank you for the reply FixTestRepeat. That is indeed a way to discover dynamic tags, and in theory, after that I could do something like
cumulativeSum(columns: my_tags)
but I cannot find a way to convert column of _value
(ie output of columns()
) to array of strings…
Still learning this myself, but @scott suggested a few days ago to someone else looking at sub queries to use join
, but don’t know if that will work for your use case.
You can use findColumn()
to extract an array of column values.
data
|> findColumn(fn: (key) => true, column: "_value")