Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 4 : They are kept, with NaN in df2's columns / वे बनी रहती हैं, df2 के कॉलमों में NaN आता है

Advertisement

Detailed Solution

सही उत्तर They are kept, with NaN in df2's columns / वे बनी रहती हैं, df2 के कॉलमों में NaN आता है है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

With how='left' in pd.merge(df1, df2, on='id'), what happens to df1 rows that have no matching 'id' in df2? / pd.merge(df1, df2, on='id') में how='left' होने पर df1 की उन पंक्तियों का क्या होता है जिनका 'id' df2 में नहीं मिलता?

1.
They are dropped from the result / वे परिणाम से हटा दी जाती हैं
2.
They raise a MergeError / वे MergeError देती हैं
3.
They are matched with the first row of df2 / वे df2 की पहली पंक्ति से जुड़ जाती हैं
4.
They are kept, with NaN in df2's columns / वे बनी रहती हैं, df2 के कॉलमों में NaN आता है

Correct Answer: They are kept, with NaN in df2's columns / वे बनी रहती हैं, df2 के कॉलमों में NaN आता है

A left merge preserves every row of the left DataFrame; columns coming from the right DataFrame contain NaN where no key matches. / लेफ्ट मर्ज बाएँ DataFrame की हर पंक्ति बनाए रखता है; दाएँ DataFrame से आए कॉलमों में जहाँ कुंजी न मिले वहाँ NaN होता है।

Downloaded from PrepSnap (prepsnap.in)