Question
Option 1 : df.iloc[0:2] selects the first two rows by position, excluding the stop position / df.iloc[0:2] स्थिति के अनुसार पहली दो पंक्तियाँ चुनता है, अंतिम स्थिति को छोड़कर
Detailed Solution
सही उत्तर df.iloc[0:2] selects the first two rows by position, excluding the stop position / df.iloc[0:2] स्थिति के अनुसार पहली दो पंक्तियाँ चुनता है, अंतिम स्थिति को छोड़कर है।
Question:
Which statement about pandas indexing is TRUE? / pandas इंडेक्सिंग के बारे में कौन-सा कथन सत्य है?
Correct Answer: df.iloc[0:2] selects the first two rows by position, excluding the stop position / df.iloc[0:2] स्थिति के अनुसार पहली दो पंक्तियाँ चुनता है, अंतिम स्थिति को छोड़कर
iloc slices by integer position and excludes the stop, like Python slicing; loc slices by label and includes the stop label. The two are not interchangeable. / iloc पूर्णांक स्थिति से स्लाइस करता है और अंतिम स्थिति को छोड़ता है, जैसे पायथन स्लाइसिंग; loc लेबल से स्लाइस करता है और अंतिम लेबल को शामिल करता है। दोनों परस्पर बदले नहीं जा सकते।