我有一个名为df
的数据帧
season seed team
1609 2010 W01 1246
1610 2010 W02 1452
1611 2010 W03 1307
1612 2010 W04 1458
1613 2010 W05 1396
我需要以下格式的新数据帧:
team frequency
1246 01
1452 02
1307 03
1458 04
1396 05
frequency值来自数据帧df
中名为seed
的列
W01 -> 01
W02 -> 02
W03 -> 03
我该如何在熊猫身上做到这一点?你知道吗
下面的解决方案使用lambda函数应用regex来删除非数字字符。你知道吗
http://pythex.org/?regex=%5CD&test_string=L16a&ignorecase=0&multiline=0&dotall=0&verbose=0
收益率
相关问题 更多 >
编程相关推荐