我有两个变量重要性排名,我想比较每个变量在Y轴上的增减情况,在Z轴和X轴上的排名只有两个值R1
和{{ 1}}
创建虚拟数据集:
R2
到目前为止-
import pandas
import matplotlib.pyplot as plt
from pandas.tools.plotting import parallel_coordinates
df=pd.DataFrame({'var':['x','y','z','a','b','c'],
'rank_1':[1,2,3,4,5,6],
'rank_2':[1,4,2,5,3,6]})
df['diff']=df['rank_1']-df['rank_2']
df['impact']=np.where(df['diff']<0,"Decrease",np.where(df['diff']==0,"Same","Increase"))
df
如何在与Y轴相反的另一个Z轴上获取变量名(变量列)?