Open zac215 opened 7 months ago
I am also facing the same situation and things are getting difficult a production senerio.
I am also facing the same situation and things are getting difficult a production senerio.
I finaly got the expected result with no transformation methods and no pipeline. I just infered schema, edited it, and then rewrite the data according to the new schema. Here is the code:
from frictionless import Resource, formats
def remove_number(field_name):
match = search(r'\d+\.\s(.+)', field_name)
if match:
return match.group(1)
else:
return field_name
source = Resource(path="reponse_3.csv")
source.infer()
schema= source.schema
for field_name in schema.field_names:
schema.update_field(name=field_name, descriptor={ 'name':remove_number(field_name)})
source.schema=schema
source.write('reponse_4b.csv', control=formats.CsvControl(delimiter=';'), encoding='utf-8')
Overview
I use some code to change field_names with regex but when the pipeline contains the steps for more than 87 fields I get this error I don't understand:
frictionless.exception.FrictionlessException: [step-error] Step is not valid: "field_update" raises "maximum recursion depth exceeded in instancecheck"
Here is my code:
Thanks