Image of how my dataframe looks at the minute 我想把一個新的列放到我的數據框中,名爲「議會」,這將基於鎮字段。舉例來說,如果Town == Belfast,我想新的專欄委員會保持價值貝爾法斯特。但要注意的是,這些議會的一些價值觀與城鎮並不相同。另一個例子可能是,鎮可能是Clogher,我想把理事會價值弗馬納。我對Python非常陌生,非常感謝任何幫助。
我有以下一些行的數據幀: - restaurantName cuisine totalRating delivery
Bindia Indian Bistro indian 4.0 Yes
Bhoj Indian Cuisine indian 4.5 Yes
Indian Roti House indian 4.0 Yes
Utsav indian
爲了簡單起見,可以說我有這個數據框。 Date Open Close
2016-01-01 100 129
2016-01-02 198 193
2016-01-03 103 102
2016-01-04 102 109
我不能列出所有列名,因爲有太多。那麼我怎樣才能移動除了其中兩個以外的所有列(日期&關閉)?我想將除了(日期&關閉)之外的所有列移回一行。 Date