Do what np.select(condlist, choicelist) does but instead with pandas only
问题 I have code and it works fine: import numpy as np import pandas as pd x = np.arange(10) condlist = [x<3, x==5, x>5] choicelist = [x, x**2, x**3] a=np.select(condlist, choicelist) Now lets add: y=pd.Series(x) Lets now use y instead of x . Now we need to get same result (same content as a has, and it should be Series.) with pandas only , and the conditions and choices should be coded as above (use above code for coding conditions and choices). How to do that? 回答1: construct a dataframe from