import numpy as np
import pandas as pd
index = pd.date_range('1/1/2019', periods=6)
s = pd.Series(np.random.randn(6), index=['a', 'b', 'c', 'd', 'e','f'])
df = pd.DataFrame(np.random.randn(6, 4), index=index,
columns=['P', 'Q', 'R','S'])
To view a small sample of a Series or DataFrame object, use the head() and tail() methods. The default number
of elements to display is five, but you may pass a custom number.
long_series = pd.Series(np.random.randn(800))
long_series.head()
long_series.tail(3)
import numpy as np
import pandas as pd
s = pd.Series(np.random.randn(5), index=['white', 'black', 'blue', 'red', 'green'])
df = pd.DataFrame({'color':['white', 'black', 'blue', 'red', 'green']})
df
df.tail(4)