ageron / handson-ml

⛔️ DEPRECATED – See https://github.com/ageron/handson-ml3 instead.
Apache License 2.0
25.14k stars 12.91k forks source link

chapter one / not understanding pd.read parameters #588

Open KhidirA opened 3 years ago

KhidirA commented 3 years ago

hey all I'm trying to run the code example from chapter one in the book I know it said I have to have an idea about the libraries (which I kind of do from a coursera machine learning course) but I failed to understand line 8 I know the first parameter if locating the file but what is the second one do? also can anyone explain the next line too what are the parameters mean?

Praful932 commented 3 years ago

Hi @KhidirA Could you specify which notebook or better paste the code in codeblocks here

pdx97 commented 3 years ago

@KhidirA exactly which parameter are you not able to understand can you show the code here and the exact line number .

ageron commented 3 years ago

Hi @KhidirA ,

If I understand correctly you were confused about the arguments to the pd.read_csv() function in chapter 1:

oecd_bli = pd.read_csv(datapath + "oecd_bli_2015.csv", thousands=',')
gdp_per_capita = pd.read_csv(datapath + "gdp_per_capita.csv",thousands=',',delimiter='\t',
                             encoding='latin1', na_values="n/a")

This function loads a CSV file. Here's what the arguments mean:

If you search "pandas read_csv" on Google, you'll find this documentation page which explains these arguments as well as many others.

Hope this helps.