You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remember: Always examine your data before and after merging to ensure the operation worked as expected. When in doubt, start with a small sample of your data to test your merge logic!
<divclass="sourceCode cell-code" id="cb3"><preclass="sourceCode python code-with-copy"><codeclass="sourceCode python"><spanid="cb3-1"><ahref="#cb3-1" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Inner join - only students with grades</span></span>
<divclass="sourceCode cell-code" id="cb5"><preclass="sourceCode python code-with-copy"><codeclass="sourceCode python"><spanid="cb5-1"><ahref="#cb5-1" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Left join - all students, with grades where available</span></span>
<divclass="sourceCode cell-code" id="cb7"><preclass="sourceCode python code-with-copy"><codeclass="sourceCode python"><spanid="cb7-1"><ahref="#cb7-1" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Right join - all grades, with student info where available</span></span>
<divclass="sourceCode cell-code" id="cb9"><preclass="sourceCode python code-with-copy"><codeclass="sourceCode python"><spanid="cb9-1"><ahref="#cb9-1" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Outer join - all students and all grades</span></span>
<divclass="sourceCode cell-code" id="cb13"><preclass="sourceCode python code-with-copy"><codeclass="sourceCode python"><spanid="cb13-1"><ahref="#cb13-1" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Create DataFrames with datetime indices (common in time series data)</span></span>
@@ -688,7 +688,7 @@ <h2 class="anchored" data-anchor-id="concatenating-dataframes">Concatenating Dat
688
688
<p>Use <code>pd.concat()</code> to stack DataFrames vertically or horizontally:</p>
<divclass="sourceCode cell-code" id="cb15"><preclass="sourceCode python code-with-copy"><codeclass="sourceCode python"><spanid="cb15-1"><ahref="#cb15-1" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Create additional data for different years</span></span>
<divclass="sourceCode cell-code" id="cb17"><preclass="sourceCode python code-with-copy"><codeclass="sourceCode python"><spanid="cb17-1"><ahref="#cb17-1" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Create separate DataFrames with same index</span></span>
<divclass="sourceCode cell-code" id="cb19"><preclass="sourceCode python code-with-copy"><codeclass="sourceCode python"><spanid="cb19-1"><ahref="#cb19-1" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Simulate the Eurovision data merging scenario</span></span>
<divclass="sourceCode cell-code" id="cb21"><preclass="sourceCode python code-with-copy"><codeclass="sourceCode python"><spanid="cb21-1"><ahref="#cb21-1" aria-hidden="true" tabindex="-1"></a><spanclass="co"># Create simple temperature and CO2 data</span></span>
<spanid="cb31-13"><ahref="#cb31-13" aria-hidden="true" tabindex="-1"></a><spanclass="bu">print</span>(<spanclass="st">"All possible combinations:"</span>)</span>
1039
1039
<spanid="cb31-14"><ahref="#cb31-14" aria-hidden="true" tabindex="-1"></a><spanclass="bu">print</span>(result_all)</span></code><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></pre></div>
1040
-
<p>Remember: Always examine your data before and after merging to ensure the operation worked as expected. When in doubt, start with a small sample of your data to test your merge logic!</p>
0 commit comments