automobile数据集中没用的列是哪些
时间: 2024-05-21 13:11:36 浏览: 15
对于这个问题,我可以回答:在automobile数据集中,没有用的列包括symboling(符号化)、normalized_losses(归一化损失)、num_doors(车门数量)、engine_location(发动机位置)、engine_type(发动机类型)、num_cylinders(汽缸数量)、fuel_system(燃油系统)这几列。
相关问题
删除automobile数据集中具有缺失值的列
可以使用pandas库的dropna()函数来删除具有缺失值的列,具体操作方式可以参考以下代码:
import pandas as pd
df = pd.read_csv('automobile.csv') # 读取汽车数据集
df.dropna(axis='columns', inplace=True) # 删除具有缺失值的列
print(df.head()) # 打印删除后的数据集前几行
automobile数据集里元素不是数字的列有哪些
可以使用以下代码来查看automobile数据集中不是数字的列:
```
import pandas as pd
# 读取automobile数据集
df = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/autos/imports-85.data',header=None)
# 设置列名
df.columns = ['symboling', 'normalized-losses', 'make', 'fuel-type', 'aspiration', 'num-of-doors', 'body-style', 'drive-wheels', 'engine-location', 'wheel-base', 'length', 'width', 'height', 'curb-weight', 'engine-type', 'num-of-cylinders', 'engine-size', 'fuel-system', 'bore', 'stroke', 'compression-ratio', 'horsepower', 'peak-rpm', 'city-mpg', 'highway-mpg', 'price']
# 查看不是数字的列
for column in df.columns:
if not pd.api.types.is_numeric_dtype(df[column]):
print(column)
```
运行上述代码后会输出不是数字的列:make、fuel-type、aspiration、num-of-doors、body-style、drive-wheels、engine-location、engine-type、fuel-system
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)