Usage
Commands
Note
This documentation can also be obtained by running
life-expectancy --help from the terminal window.
Or, to get help for a specific subcommand, run
life-expectancy <subcommand> --help.
life-expectancy
life-expectancy let’s you explore life expectancy data presented in Chapter
1 of the book Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow (3rd ed.).
download-data: downloads the three.csvdata files. The simplified data from the book web page, the full better life index data from sdmx.oecd.org, and the GDP per capita data from ourworldindata.org.plot-simplified: plots the simplified data file using matplotlib.info: prints information about the downloaded data files.info-gdp: prints information about the GDP data file.plot-gdp: plots the GDP data file using matplotlib. or plotly.bli-extract-column: extracts a column from the full Better Life Index data file.bli-extract-subtable: extracts a sub table from the full Better Life Index data file.linear-regression: performs linear regression on the simplified data file. Plots theregression line and the data points using matplotlib.
life-expectancy [OPTIONS] COMMAND [ARGS]...
Options
- -v, --verbose
Show verbose output
bli-extract-column
life-expectancy bli-extract-column extracts a column from the full
Better Life Index data file.
life-expectancy bli-extract-column [OPTIONS] COLUMN_NAME
Options
- -u, --unique
Show unique values
Arguments
- COLUMN_NAME
Required argument
bli-extract-subtable
life-expectancy bli-extract-subtable extracts a sub table from the full Better Life Index data file.
It extracts all rows where the ‘INEQUALITY’ column matches the inequality argument. Then, creates
a pivot table with the ‘Country’ column as the index, the ‘Indicator’ column as the columns,
and the ‘OBS_VALUE’ column as the values. Valid values for the inequality argument are:
TOT, WMN, MN, LW, and HGH. (Or alternatively use the full names: TOTAL, WOMAN, MAN, LOW, HIGH).
life-expectancy bli-extract-subtable [OPTIONS]
Options
- --inequality <inequality>
Which sub table to include
download-data
life-expectancy download-data downloads the life-expectancy data. First,
the simplified data from the book’s web page, is downloaded, then the
full better life index data will be downloaded from
sdmx.oecd.org,
and finally the GDP per capita data will be downloaded from
ourworldindata.org. NOTE:
The last data file is not available for direct download, so it has been uploaded
to the author’s GitHub repo instead.
life-expectancy download-data [OPTIONS]
info
life-expectancy info prints information about the downloaded data files.
life-expectancy info [OPTIONS]
Options
- -d, --details
Show detailed data about each file
info-gdp
life-expectancy info-gdp prints information about the GDP data file.
life-expectancy info-gdp [OPTIONS]
linear-regression
life-expectancy linear-regression performs linear regression on the combined
GDP and life satisfaction data. If option --simplified is used, it will use the
simplified data. Otherwise, it will use the full data. If the full data is used, the
data will be filtered by the year specified with the --year option. The default
year is 2021. The regression line and the data points are plotted using matplotlib.
life-expectancy linear-regression [OPTIONS]
Options
- -s, --simplified
Use simplified data
- -y, --year <year>
Year to filter the full data
plot-gdp
life-expectancy plot-gdp creates a bar plot of the GDP data. If the data
is not found, it will be downloaded. The data is filtered by the year
specified with the --year option. The default year is 2021.
The data can be plotted using Matplotlib or Plotly, with the --plotly
option.
life-expectancy plot-gdp [OPTIONS]
Options
- -y, --year <year>
Year to filter the data
- -p, --plotly
Use Plotly for plotting
plot-simplified
life-expectancy plot-simplified scatter plots the simplified downloaded data. If the data
is not found, it will be downloaded. The data can be plotted using Matplotlib or Plotly, with the
--plotly option.
life-expectancy plot-simplified [OPTIONS]
Options
- -p, --plotly
Use Plotly for plotting