0
$\begingroup$

In a csv discussed in the book HoML (hands on machine learning), what do the values in capital letters represent? Are these some sort of code? Also, it seems the pandas.pivot() methods does something with these values. So what are these values for and what does pandas.pivot() do with it?

oecd_bli = pd.read_csv(datapath + "oecd_bli_2015.csv", thousands=',')
oecd_bli = oecd_bli[oecd_bli["INEQUALITY"]=="TOT"]
oecd_bli = oecd_bli.pivot(index="Country", columns="Indicator", values="Value")

The csv is available in this link of the homl github.

link to csv on homl github

I looked at other .csv and they look different, also I searched on the pandas help but didn't get the answer.

thank you

$\endgroup$
1
  • $\begingroup$ please consult the data source. $\endgroup$
    – lpounng
    Dec 28, 2023 at 3:57

1 Answer 1

1
$\begingroup$

Based on the link you provided, the README.md does provide the original data source: https://stats.oecd.org/index.aspx?DataSetCode=BLI#

There you can see that the values mean: "Total", "Men", "Women", "High" and "Low"

The pivot() method in pandas is used to reshape data. In your code snippet, it transforms the data so that each row represents a country, each column represents a different indicator, and cell values are the corresponding values from the original dataset.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.