Data Import with pandas
To import the Boston Housing Prices dataset and build a DataFrame with column names for the target and features, you can use the load_boston() function from sklearn.datasets and then create the DataFrame using pandas. Here's the code to do that:
The dataset has data, target, feature_names attributes as shown below:
In order to construct a dataframe, use the code below:
https://ai-fin-tech.tistory.com/entry/Subsetting-Rows-with-Categorical-Variables
Subsetting Rows with Categorical Variables
Data Import Since there is no categorical variables in Boston dataset, I will just show you the example using dummy dataset. Let's consider a hypothetical dataset called "employee_data" with a categorical variable "Department" and other numerical features.
ai-fin-tech.tistory.com
'Tech > Python' 카테고리의 다른 글
pandas - Complete Usage of loc and iloc (1) | 2023.07.30 |
---|---|
pandas - Subsetting Columns and Rows (1) | 2023.07.30 |
pandas - Sorting DataFrame (1) | 2023.07.30 |
pandas - Basic DataFrame Inspection (1) | 2023.07.30 |
기계 학습을 위한 무료 데이터셋 Top 3 (2) | 2023.07.30 |
댓글