Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
What the course covers
Import data into pandas from CSV, Excel, JSON, and databases.
- Clean and prepare data: missing values, formats, normalization, and binning.
- Explore data with statistics and plots. Find patterns and relations.
- Build regression models, evaluate and refine them, then finish a final project.
| Module | Main focus |
|---|---|
| 1. Importing Data Sets | pandas, reading CSV/Excel/JSON, head, dtypes, describe, databases |
| 2. Data Wrangling | Missing values, formatting, normalization, binning, categorical variables |
| 3. Exploratory Data Analysis | Descriptive statistics, GroupBy, plots, correlation, chi-square |
| 4. Model Development | Linear and multiple regression, pipelines, in-sample evaluation |
| 5. Model Evaluation and Refinement | Overfitting, underfitting, ridge regression, grid search |
| 6. Final Assignment | Practice project, final project, final exam, badge |
Module 1: Importing Data Sets
pandas is the main library for data analysis in Python.
- Read a CSV with pd.read_csv, Excel with pd.read_excel, and JSON with pd.read_json.
- head() and tail() show rows. shape gives rows and columns.
- info() shows types and null counts. describe() gives summary statistics.
- Read from a database with pandas.read_sql and a connection object.
Module 2: Data Wrangling
Missing values can be dropped with dropna or filled with fillna.
- Fill gaps with the mean, the median, the mode, or a fixed value.
- Fix types with astype, and clean text with the pandas str methods.
- Min-max normalization puts values on a 0 to 1 scale. Z-score uses the mean and the standard deviation.
- Binning turns a number into groups, like price ranges.
- Categorical values become numbers with one-hot encoding (dummy variables).
Module 3: Exploratory Data Analysis
Descriptive statistics: mean, median, standard deviation, min, max, and quartiles.
- GroupBy splits the data into groups, then applies a function.
- Pick the right plot: histogram for one number, box plot for spread, scatter for two numbers.
- Correlation runs from -1 to +1. It shows the strength of a linear relation.
- Correlation is not causation.
- The chi-square test checks if two categorical variables are related.
Module 4: Model Development
Linear regression fits a line: y = b0 + b1 x. Multiple linear regression uses more than one input.
- Least squares picks the line with the smallest sum of squared errors.
- Plot the fitted line over the data to see the fit.
- R-squared is the share of variance explained. It goes up to 1.
- MSE and RMSE measure the error. Lower is better.
Module 5: Model Evaluation and Refinement
Overfitting fits the training data too well. Underfitting is too simple and misses the pattern.
- Split the data into train and test. Test on data the model did not see.
- Ridge regression adds a penalty that keeps the coefficients small.
- Grid search tries many settings and picks the best score.
Module 6: Final Assignment
The final assignment takes a real data set from import to model.
- Show each step: load, clean, explore, model, refine, and conclude.
- Write short notes to explain each choice.
- Report the scores clearly and keep the notebook easy to read.
Check yourself
Answer each question first, then open it to check the answer.
1Which call reads a CSV file into a DataFrame? a) pd.read_excel · b) pd.read_json · c) pd.read_csv · d) pd.read_sql
c) pd.read_csv. read_csv reads a comma-separated file.
2What does head() show? a) The first rows of the data · b) The last rows of the data · c) Only the column names · d) A chart
a) The first rows of the data. head() shows the first rows.
3Which call fills missing values? a) dropna() · b) fillna() · c) head() · d) describe()
b) fillna(). fillna() replaces the missing values.
4A column "color" has red, green, and blue. What is a good way to use it in a model? a) Delete the column · b) Turn each color into a random number · c) One-hot encode it into 0/1 columns · d) Sort the rows
c) One-hot encode it into 0/1 columns. One-hot encoding makes 0/1 columns for each category.
5What does min-max normalization do? a) It puts values on a 0 to 1 scale · b) It deletes small values · c) It adds a trend line · d) It removes columns
a) It puts values on a 0 to 1 scale. Min-max maps the smallest value to 0 and the largest to 1.
6Which plot shows the distribution of one numeric column? a) Scatter plot · b) Line plot · c) Pie chart · d) Histogram
d) Histogram. A histogram shows the count per value range.
7A correlation of +0.95 means: a) The variables are not related · b) A strong positive linear relation · c) One variable causes the other · d) The data has no mean
b) A strong positive linear relation. Values near +1 mean a strong positive linear relation.
8R-squared close to 1 means: a) The model is random · b) The error is large · c) The model explains most of the variance · d) The model needs no data
c) The model explains most of the variance. R-squared close to 1 means most variance is explained.
9Why do we keep a test set? a) To check the model on data it did not see · b) To train faster · c) To clean the data · d) To draw a histogram
a) To check the model on data it did not see. The test set checks how the model works on new data.
10A model scores 0.99 on training data and 0.60 on test data. What is this? a) Underfitting · b) A perfect model · c) A data type error · d) Overfitting
d) Overfitting. A big gap between train and test is overfitting.
11What does ridge regression add to the model? a) More rows · b) A penalty on large coefficients · c) A new data set · d) A scatter plot
b) A penalty on large coefficients. Ridge adds a penalty to keep coefficients small.
Study and exam tips
Know the pandas calls: read_csv, read_excel, read_json, read_sql, head, info, describe.
- dropna removes rows. fillna fills them. Do not mix them up.
- Correlation shows relation, not cause. If an option says "proves cause", it is wrong.
- High training score plus low test score means overfitting.