import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv("data.csv")
dataframe = df.select_dtypes(include='number')
fig = plt.figure(figsize=(40,8))
for i in range(len(dataframe.columns)-2):
ax = fig.add_subplot(1, i+5, i+1, projection='3d')
x = dataframe.iloc[:,i]
y = dataframe.iloc[:,i+1]
z = dataframe.iloc[:,i+2]
ax.scatter(x, y, z)
ax.set_xlabel(dataframe.columns[i])
ax.set_ylabel(dataframe.columns[i+1])
ax.set_zlabel(dataframe.columns[i+2])
plt.subplots_adjust(wspace=1)
plt.show()
这是我的数据集链接 https://drive.google.com/file/d/1UgUwx5_j1wjDzLqQmAXOBXHJf1O7mIDP/view?usp=sharing
Gender,Age,Months_Count,Salary,Expenditure,House_Price
1,2,3,1,34,9884
1,2,34,0,56,2442
1,111,231,1,56,2421
0,49,65,0,156,6767
0,439,625,20,1256,452555