Hi,
I'm currently trying to migrate an existing file initially written in Brainscript into Python-based nodes and am having some trouble finding an appropriate analogue to 2 specific functions: "inputFields" and "field". Is there an easy way to use these functions in Python that I'm overlooking? More information is below if it helps at all:
The "inputFields" function seems to take in 1 parameter, a number, and returns the column name for the given index number. Eg. inputFields(3) will give the name of the 3rd column.
The "field" function seems to take in 1 parameter, a string, and returns the value for the given column name string. Eg. field("FavouriteColor") will effectively return the value in the "FavouriteColor" column. However, the strength of this function is in its ability to be dynamic. For example, if there's a column A that's filled with a variety of column names (such as B, C, D, etc.), using the "field" function in a different column X will allow column X to return values from B, C, D, etc.
Essentially these 2 functions can be used together in a Do While Conditional loop to take a file with many columns and convert it into a file with less columns and many rows. Eg. if there's a file with columns such as Value_A, Value_B, Value_C, ..., Value_Z, these 26 columns could be replaced with 2 columns. One called Column Name which uses the "inputFields" function on a counter variable and one called "Value" which uses the "field" function on the value returned from the "inputFields" function.
If it helps, the below is effectively the exact code used to do this:
Fields = inputFields()
emit *
override emit Fields['Counter'] as "Column Name"
override emit (field(Fields['Counter'])) as "Value"