Function Intermediate (arguments)

I resolved the exercise but I have a doubt. Can you put only one argument predefined?
When I put:
def open_dataset(file_name=‘AppleStore.csv’,header):
I have an error: SyntaxError: non-default argument follows default argument
And when I put:
def open_dataset(file_name=‘AppleStore.csv’,header=True):
It´s OK
I thought you could decide to put an argument predefined or not

Hi @walterjose.plt, welcome to the community!
As the error indicates, in defining a function which takes arguments, you cannot have an argument without a default value after one with a default value; the reverse, however, works. Your code will work if you define the function header as follows:

def open_dataset(header, file_name=‘AppleStore.csv’):

You may read more about this here

Hopefully this helps.

2 Likes

Thanks a lot @enext7771 . I didn’t see this point in the guide. Your explanation have resolved completely mi doubt.
And thanks for welcome. I hope to learn a lot of things about data science

@walterjose.plt, glad to know my response was helpful. Never hesitate to come to the community for support as you go through the courses.

Happy learning!