{"blog_url":"https://a1026302.hatenablog.com/","categories":[],"title":"\u3010python\u3011pandas \u3067\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3057\u305f\u5f8c\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u30ab\u30a6\u30f3\u30c8\u65b9\u6cd5\u3092\u8abf\u67fb","height":"190","url":"https://a1026302.hatenablog.com/entry/2025/07/11/125808","provider_url":"https://hatena.blog","image_url":"https://cdn.user.blog.st-hatena.com/default_entry_og_image/157314735/1599576939808917","provider_name":"Hatena Blog","description":"pandas \u3067\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3057\u305f\u5f8c\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u30ab\u30a6\u30f3\u30c8\u65b9\u6cd5\u3092\u8abf\u67fb\u3057\u3066\u307f\u307e\u3057\u305f\u3002 both \u30b3\u30fc\u30c9 \u307e\u3068\u3081 right_only \u30b3\u30fc\u30c9 \u307e\u3068\u3081 right_only \u30b3\u30fc\u30c9 \u307e\u3068\u3081 both \u30b3\u30fc\u30c9 import pandas as pd df = pd.DataFrame({ \"_merge\": [\"both\", \"left_only\", \"both\", \"both\"], \"XXX_ID\": [1, 2, 1, 3] }) # \u91cd\u8907\u542b\u3080 \"both\" \u306e\u6570 print(int((df[\"_merge\"] == \"both\").sum())) # \u2192 3 # XXX_ID \u30d9\u30fc\u30b9\u3067\u91cd\u8907\u9664\u5916\u3057\u2026","blog_title":"\u3082\u306e\u3065\u304f\u308a\u306e\u30d6\u30ed\u30b0","author_name":"a1026302","author_url":"https://blog.hatena.ne.jp/a1026302/","published":"2025-07-11 12:58:08","width":"100%","type":"rich","version":"1.0","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fa1026302.hatenablog.com%2Fentry%2F2025%2F07%2F11%2F125808\" title=\"\u3010python\u3011pandas \u3067\u30c6\u30fc\u30d6\u30eb\u3092\u7d50\u5408\u3057\u305f\u5f8c\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u30ab\u30a6\u30f3\u30c8\u65b9\u6cd5\u3092\u8abf\u67fb - \u3082\u306e\u3065\u304f\u308a\u306e\u30d6\u30ed\u30b0\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>"}