Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maximum recursion depth exceeded for field_update method when applying transformation #1621

Open
zac215 opened this issue Jan 16, 2024 · 0 comments

Comments

@zac215
Copy link

zac215 commented Jan 16, 2024

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:

from re import search 
from os import remove
from frictionless import  Resource, steps, formats, Schema, Pipeline,transform
source = Resource(path="reponse_3.csv")
schema = Schema.describe("reponse_3.csv")
field_names=schema.field_names
step_list=[]
def remove_number(field_name):
    match = search(r'\d+\.\s(.+)', field_name)
    if match:
        return match.group(1)  
    else:
        return field_name  
for field_name in field_names:
    step_list.append(steps.field_update(name=field_name, descriptor={"name":remove_number(field_name)}))
pipeline = Pipeline(steps=step_list)
target= source.transform(pipeline)
target.write('reponse_3.csv', control=formats.CsvControl(delimiter=';'), encoding='utf-8') 

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant