Read only header, first two rows or specified range.
import pandas as pd
def test_run():
df = pd.read_csv("data/AAPL.csv")
print df.head(n=1)
print df.tail(n=2)
print df[2:3]
if __name__ == "__main__":
test_run()
Here is the output.
Date Open High Low Close Volume Adj Close
0 2017-01-20 120.449997 120.449997 119.730003 120.0 29479900 120.0
Date Open High Low Close Volume Adj Close
5 2017-01-12 118.900002 119.300003 118.209999 119.250000 27002400 119.250000
6 2017-01-11 118.739998 119.930000 118.599998 119.750000 27418600 119.750000
Date Open High Low Close Volume Adj Close
2 2017-01-18 120.0 120.5 119.709999 119.989998 23644700 119.989998