我有 csv 格式的购买数据。
| Name | Sex | Week
|------------|-------------|--------------
| Apple | F | Mon
| Orange | F | Tue
| Apple | M | Fri ...
| Grape | M | Mon
我想要转换后的 csv ...
| Name:Apple | Name:Orange | Name:Grape | Sex:F | Sex:M | Week:Mon | Week:Tue |
| 1 | 0 | 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 | 1 | ...
| 1 | 0 | 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 | 1 | 0 |
R或Python有什么好的转换方法吗?谢谢。