我在不同的机器上运行了一些 pcmark 测试。最后我想巩固机器结果。我已经修改了最终结果以显示。我尝试过使用 pandas 进行不同形式的合并,但我无法得到预期的结果,但这已经足够接近了。任何建议,将不胜感激
来自机器 1 的数据帧:
|------------|---------------------------|--------------|------------|
|Test Case | SubTest | App | Count |
|------------|---------------------------|--------------|------------|
|pcmark10 | AppStartUp | NaN | NaN |
|pcmark10 | PhotoEditing | NaN | NaN |
|pcmark10 | RenderingAndVisualization | NaN | NaN |
|pcmark10 | Spreadsheet | soffice.bin | 1.0 |
|pcmark10 | VideoConferencing | NaN | NaN |
|pcmark10 | VideoEditing | NaN | NaN |
|pcmark10 | WebBrowsing | NaN | NaN |
|pcmark10 | Writing | NaN | NaN |
|------------|---------------------------|--------------|------------|
来自机器 2 的数据框:
|------------|---------------------------|--------------|------------|
|Test Case | SubTest | App | Count |
|------------|---------------------------|--------------|------------|
|pcmark10 | AppStartUp | NaN | NaN |
|pcmark10 | PhotoEditing | NaN | NaN |
|pcmark10 | RenderingAndVisualization | NaN | NaN |
|pcmark10 | Spreadsheet | NaN | NaN |
|pcmark10 | VideoConferencing | NaN | NaN |
|pcmark10 | VideoEditing | NaN | NaN |
|pcmark10 | WebBrowsing | chrome.exe | 2 |
|pcmark10 | Writing | NaN | NaN |
|------------|---------------------------|--------------|------------|
我希望结果如下所示:
|------------|---------------------------|--------------|------------|------------|
|Test Case | SubTest | App | Count_x | Count_y |
|------------|---------------------------|--------------|------------|------------|
|pcmark10 | AppStartUp | NaN | NaN | NaN |
|pcmark10 | PhotoEditing | NaN | NaN | NaN |
|pcmark10 | RenderingAndVisualization | NaN | NaN | NaN |
|pcmark10 | Spreadsheet | soffice.bin | 1.0 | NaN |
|pcmark10 | VideoConferencing | NaN | NaN | NaN |
|pcmark10 | VideoEditing | NaN | NaN | NaN |
|pcmark10 | WebBrowsing | chrome.exe | NaN | 2 |
|pcmark10 | Writing | NaN | NaN | NaN |
|------------|---------------------------|--------------|------------|------------|
我尝试了结合所有键的外部合并,这就是我得到的。使用外部函数将 pcmark10 的行值引导为空白。应用列中缺少 Chrome。
|------------|---------------------------|--------------|------------|------------|
|Test Case | SubTest | App | Count_x | Count_y |
|------------|---------------------------|--------------|------------|------------|
|pcmark10 | AppStartUp | NaN | NaN | NaN |
|pcmark10 | PhotoEditing | NaN | NaN | NaN |
|pcmark10 | RenderingAndVisualization | NaN | NaN | NaN |
|pcmark10 | Spreadsheet | soffice.bin | 1.0 | NaN |
|pcmark10 | VideoConferencing | NaN | NaN | NaN |
|pcmark10 | VideoEditing | NaN | NaN | NaN |
|pcmark10 | WebBrowsing | NaN | NaN | 2 |
|pcmark10 | Writing | NaN | NaN | NaN |
|------------|---------------------------|--------------|------------|------------|
合并命令:- pd.merge(df1, df2, on=['Test Case', 'SubTest', 'App'], how="outer", indicator=True)