print(1)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
amount fruits year 0 1 apple 2001 1 4 orange 2002 2 5 banana 2001 3 6 strawberry 2008 4 3 kiwifruit 2006 print(2) fruits price year 0 apple 150 2001 1 orange 120 2002 2 banana 100 2001 3 strawberry 250 2008 4 mango 3000 2007 <span role="presentation"><span class="cm-variable">df3</span> = <span class="cm-variable">pd</span>.<span class="cm-property">merge</span>(<span class="cm-variable">1</span>, <span class="cm-variable">2</span>, <span class="cm-variable">on</span>=<span class="cm-string">"fruits"</span>, <span class="cm-variable">how</span>=<span class="cm-string">"inner"</span>) <span class="cm-builtin">print</span>(<span class="cm-variable">df3</span>)</span> amount fruits year_x price year_y 0 1 apple 2001 150 2001 1 4 orange 2002 120 2002 2 5 banana 2001 100 2001 3 6 strawberry 2008 250 2008 |
コメントを残す