Python Forum
Slicing dataframe as series vs. dataframe? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Slicing dataframe as series vs. dataframe? (/thread-34673.html)



Slicing dataframe as series vs. dataframe? - Mark17 - Aug-19-2021

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.