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. We will use this dataset to subset rows based on the "Department" category.

Subsetting rows based on the categorical variable "Department"

Filtering Categorical Variables using .isin()
Below is an example of using .isin() instead.

https://ai-fin-tech.tistory.com/entry/Adding-New-Columns-and-Rows-to-DataFrame-with-pandas
Adding New Columns and Rows to DataFrame with pandas
Adding New Columns with pandas Since the Boston Housing Prices dataset does not contain a meaningful categorical variable, we can create a new column for feature engineering using the existing numerical features. Let's create a new column named "Age_Catego
ai-fin-tech.tistory.com
'Tech > Python' 카테고리의 다른 글
| Data Handling - Data Type (2) | 2023.08.03 |
|---|---|
| pandas - Adding New Columns and Rows to DataFrame (4) | 2023.07.30 |
| 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 |
댓글