I am working on pandas using a huge dataset that consists of helper functions and the main function which used the helper functions as getting the result.
I have many functions that accept the columns as there input. Since the input is taken from the user. Problem is that I have too many functions that input pretty much the same column.
To avoid so many functions I am thinking to use the dictionary. Were I can pass all the parameters into the function without modifying the dictionary. The function should ignore the keywords which are present in the dictionary if they are not inputted by the user.
Let us consider an example :
def func1(a, b, c):
return a + b * c
This is the dictionary which I wanted to pass to my function;
input_dict = {'a': 1,
'b': 2,
'c': 3,
'd': 4}
If I call the function using the dict
value = func1(**input_dict)
I am getting error as unexpected argument d