aurumpurum
aurumpurum

Reputation: 1082

what is wrong with calling the help function?

I have problems calling the help function on the pd.read_csv()

pandas is already imported as pd

import pandas as pd
help(pd.read_csv())

and I get

Traceback (most recent call last):
  File "<pyshell#21>", line 1, in <module>
    help(pd.read_csv())
TypeError: parser_f() missing 1 required positional argument: 'filepath_or_buffer'

What is wrong with my help call?

Upvotes: 0

Views: 274

Answers (2)

Fakher Mokadem
Fakher Mokadem

Reputation: 1099

in help(pd.read_csv()) you first called pd.read_csv() (cause of the parenthesis) so the interpreter was expecting an argument for, to execute it and return its result and pass it as argument to help.

The help function accepts functions as arguments so to show help execute help(pd.read_csv).

pd.read_csv is the function, pd.read_csv() is a call to that function.

Upvotes: 2

bruno desthuilliers
bruno desthuilliers

Reputation: 77912

Quite simply: don't call the object you want help on. Here:

help(pd.read_csv())

The parents after pd.read_csv are the function call operator. You don't want to call this function, you want to pass it as argument to help(), ie:

help(pd.read_csv)

Upvotes: 1

Related Questions