我有以下数据框:
Hotel_id Month_Year Chef_Id Chef_is_masterchef Transition
2400188 February-2018 4597566 1 0
2400188 March-2018 4597566 1 0
2400188 April-2018 4597566 1 0
2400188 May-2018 4597566 1 0
2400188 June-2018 4597566 1 0
2400188 July-2018 4597566 1 0
2400188 August-2018 4597566 1 0
2400188 September-2018 4597566 0 1
2400188 October-2018 4597566 0 0
2400188 November-2018 4597566 0 0
2400188 December-2018 4597566 0 0
2400188 January-2019 4597566 0 0
2400188 February-2019 4597566 0 0
2400188 March-2019 4597566 0 0
2400188 April-2019 4597566 0 0
2400188 May-2019 4597566 0 0
2400614 May-2015 2297544 0 0
2400614 June-2015 2297544 0 0
2400614 July-2015 2297544 0 0
2400614 August-2015 2297544 0 0
2400614 September-2015 2297544 0 0
2400614 October-2015 2297544 0 0
2400614 November-2015 2297544 0 0
2400614 December-2015 2297544 0 0
2400614 January-2016 2297544 1 1
2400614 February-2016 2297544 1 0
2400614 March-2016 2297544 1 0
当Chef_is_Masterchef列中发生从0 到 1或1 到 0 的转换时,此转换在Transition列中指示为1。
实际上,我想创建另一列(名为“ Var ”),其中的值将按照下面提到的原始数据框填充,
ITMISS
相关分类