Questions tagged «remap»

10
用字典重新映射熊猫列中的值
我有一本字典,看起来像这样: di = {1: "A", 2: "B"} 我想将其应用于类似于以下内容的数据框的“ col1”列: col1 col2 0 w a 1 1 2 2 2 NaN 要得到: col1 col2 0 w a 1 A 2 2 B NaN 我怎样才能最好地做到这一点?由于某种原因,与此相关的谷歌搜索术语仅向我显示了有关如何根据字典创建列的链接,反之亦然:-/
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.