1 拆分合并机制 Pandas库中可以对数据进行拆分,合并,使用的函数是groupby。 df = pd.DataFrame({ 'key1' : ['a', 'a', 'b', 'b', 'a'], 'key2' : ['one', 'two', 'one', 'two', 'one']