Python Forum

Full Version: Slicing dataframe as series vs. dataframe?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I just figured out this works to print out every 10th row in one df:

df.iloc[::10,]
Why did I not need double brackets, though? In this case:
df.iloc[7]
I get a series and only if I use double brackets around the 7 do I get a one-row dataframe.