I have the following function:
def splot (self,what):
df = pd.DataFrame((self.spec[what]).compute()).plot()
plt.show()
return df
I want to be able to pass parameters to the .plot() method when I call the splot function, like below:
def splot (self,what,arg=None):
df = pd.DataFrame((self.spec[what]).compute()).plot(arg)
plt.show()
return df
So when I call splot, I give it two arguments: 'what' (a string), and the arguments I want the plot command to take.
However, this doesn't work: if I pass the argument as a string, I get a KeyError, and if not, it throws a variable error. I have a feeling that *args should be involved somewhere, but not sure how to use it in this instance.