New Code Cell #6
def FChange (vector,string):
vec = vector.loc[:,string]
idx1 = np.where(vec==1)
idx2 = np.where(vec==2)
idx4 = np.where(vec==4)
idx5 = np.where(vec==5)
vec2 = np.put(vector.loc[:,string],idx1,5)
vec2 = np.put(vector.loc[:,string],idx2,4)
vec2 = np.put(vector.loc[:,string],idx4,2)
vec2 = np.put(vector.loc[:,string],idx5,1)
return vector
vec = vector.loc[:,string]
idx1 = np.where(vec==1)
idx2 = np.where(vec==2)
idx4 = np.where(vec==4)
idx5 = np.where(vec==5)
vec2 = np.put(vector.loc[:,string],idx1,5)
vec2 = np.put(vector.loc[:,string],idx2,4)
vec2 = np.put(vector.loc[:,string],idx4,2)
vec2 = np.put(vector.loc[:,string],idx5,1)
return vector
Comments
Post a Comment