#Head() or #Tail() Function || #Pandas

preview_player
Показать описание
Head & Tail
To view a small sample of a Series or the DataFrame object, use the head() and the tail() methods.
head() returns the first n rows(observe the index values). The default number of elements to display is five, but you may pass a custom number.

#head()-Returns the first n rows.,

import pandas as pd
import numpy as np

print ("The original series is:")
print (s)

print ("The first two rows of the data series:")

The original series is:
0 0.720876
1 -0.765898
2 0.479221
3 -0.139547

The first two rows of the data series:
0 0.720876
1 -0.765898

#tail()- Returns the last n rows.

import pandas as pd
import numpy as np
print ("The original series is:")
print s

print ("The last two rows of the data series:")
The original series is:
0 -0.655091
1 -0.881407
2 -0.608592
3 -2.341413

The last two rows of the data series:
2 -0.608592
3 -2.341413
dtype: float64
Рекомендации по теме
Комментарии
Автор

Thank U so much sir I am facing the issue of attribute error from few days and unable to find the cause of your video is really helpful to me. Thanks🙏🙏

A_Krishna_Devotee