0
class dataM:

   a=[]
   b=[]
   c=[]

   def __init__(self):
       self.data=[]
       self.data = pd.DataFrame(pd.read_csv(file_Name))
       self.a = self.data['a']
       self.b = self.data['b']
    
   def merge(self, col_name1, col_name2):
       concat=[self.col_name1, self.col_name2]

I am trying to reference the value passed in from the function parameter. For example, if the col_name1 equals 'a' in the merge function, merge('a', 'b'), I want the concat list to reference self.a.

3
  • see this. stackoverflow.com/questions/4075190/… Commented Dec 14, 2020 at 16:48
  • 1
    Store your lists (a, b, c) in a dictionary so you can simply do self.lists[col] Commented Dec 14, 2020 at 16:50
  • Perfect! That link helped. thank you Commented Dec 16, 2020 at 20:57

0

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.