0

I have a lot of dataframes which are sequentially named in the format "set1", "set2", "set3" ....

I need to run a for loop across all the dataframes to carry out various operations in this dataframes.

How will I convert the string "set1" to the dataframe set1 so that I can carry out operations like set1.index, set1.columns e.t.c

2
  • 1
    please share certain codes which you have tried till now , and what are the errors you facing?Share any example set. Commented Jun 3, 2019 at 9:01
  • I have not received any approapriate information regarding the issue even after a lot of research, hence I have not executed any code Commented Jun 3, 2019 at 9:04

1 Answer 1

1

Depending on whether the variables are located in the global environment or are local to the scope you are working in, you can use

## access global variable by string name
globals()['set1']

## access local variable by string name
locals()['set1']
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.