I want to dynamically load schemas to evaluate, but haven't found a method to do so.
I have a Pandas Dataframe with the Column Name as the Index. In the row are the elements to evaluate.
I was able to use tolist() to convert those elements into a list that could be paired with InListValidation, however, upon putting it to a string, it won't run within Schema.
`val_string = ""
for x in schema_df.index:
val_list = schema_df.loc[x].tolist()
col_name = x
val_string += F"Column('{col_name}', [InListValidation({val_list})]),"
validation_values = val_string`
My first thought was that perhaps it was still reading it as a string and I needed to turn it into code, so I tried both eval and exec, but the error remained the same.
Invalid number of columns. The schema specifies 1, but the data frame has 5
Thank you for advice, as this may be a user error. I also tried this method of using string with just a single column, and single line generation, in case Schema needed it to be on a new line and my string wasn't supporting that, but it told me that Schema can't be used on a Series.
I want to dynamically load schemas to evaluate, but haven't found a method to do so.
I have a Pandas Dataframe with the Column Name as the Index. In the row are the elements to evaluate.
I was able to use tolist() to convert those elements into a list that could be paired with InListValidation, however, upon putting it to a string, it won't run within Schema.
Then using it within Schema:
My first thought was that perhaps it was still reading it as a string and I needed to turn it into code, so I tried both eval and exec, but the error remained the same.
Invalid number of columns. The schema specifies 1, but the data frame has 5
Thank you for advice, as this may be a user error. I also tried this method of using string with just a single column, and single line generation, in case Schema needed it to be on a new line and my string wasn't supporting that, but it told me that Schema can't be used on a Series.