1
我有XLS格式這種形式的數據:轉換數據幀的一部分到多指標在熊貓
+--------+---------+-------------+---------------+---------+
| ID | Branch | Customer ID | Customer Name | Balance |
+--------+---------+-------------+---------------+---------+
| 111111 | Branch1 | 1 | Company A | 10 |
+--------+---------+-------------+---------------+---------+
| 222222 | Branch2 | 2 | Company B | 20 |
+--------+---------+-------------+---------------+---------+
| 111111 | Branch1 | 2 | Company B | 30 |
+--------+---------+-------------+---------------+---------+
| 222222 | Branch2 | 3 | Company C | 10 |
+--------+---------+-------------+---------------+---------+
而且我想用大熊貓來處理它。大熊貓會讀它作爲一個單一的片材,但我想在這裏使用多指標,像
+--------+---------+-------------+---------------+---------+
| ID | Branch | Customer ID | Customer Name | Balance |
+--------+---------+-------------+---------------+---------+
| | | 1 | Company A | 10 |
+ 111111 + Branch1 +-------------+---------------+---------+
| | | 2 | Company B | 30 |
+--------+---------+-------------+---------------+---------+
| | | 2 | Company B | 20 |
+ 222222 + Branch2 +-------------+---------------+---------+
| | | 3 | Company C | 10 |
+--------+---------+-------------+---------------+---------+
這裏111111
和Branch1
是1級索引和1
Company A
是級別2的索引。有沒有內置的方法來做到這一點?