Youtube Video commentary is also available.
P-017: Sort the customer data frame (df_customer) by date of birth (birth_day) in chronological order, and display all the first 10 items.
code
df_customer.sort_values('birth_day', ascending=True).head(10)
customer_id | customer_name | gender_cd | gender | birth_day | age | postal_cd | address | application_store_cd | application_date | status_cd | |
---|---|---|---|---|---|---|---|---|---|---|---|
18817 | CS003813000014 | Nanami Murayama | 1 | Female | 1928-11-26 | 90 | 182-0007 | Kikunodai, Chofu-shi, Tokyo********** | S13003 | 20160214 | 0-00000000-0 |
12328 | CS026813000004 | Yoshimura Chaoyang | 1 | Female | 1928-12-14 | 90 | 251-0043 | Tsujido Motomachi, Fujisawa City, Kanagawa Prefecture********** | S14026 | 20150723 | 0-00000000-0 |
15682 | CS018811000003 | Misato Kumazawa | 1 | Female | 1929-01-07 | 90 | 204-0004 | Noshio, Kiyose City, Tokyo********** | S13018 | 20150403 | 0-00000000-0 |
15302 | CS027803000004 | Takuro Uchimura | 0 | male | 1929-01-12 | 90 | 251-0031 | Kugenumafujigaya, Fujisawa City, Kanagawa Prefecture********** | S14027 | 20151227 | 0-00000000-0 |
1681 | CS013801000003 | Takuro Amano | 0 | male | 1929-01-15 | 90 | 274-0824 | Maebarahigashi, Funabashi City, Chiba Prefecture********** | S12013 | 20160120 | 0-00000000-0 |
7511 | CS001814000022 | Riho Tsuruta | 1 | Female | 1929-01-28 | 90 | 144-0045 | Minamirokugo, Ota-ku, Tokyo********** | S13001 | 20161012 | A-20090415-7 |
2378 | CS016815000002 | Miki Yamamoto | 1 | Female | 1929-02-22 | 90 | 184-0005 | Sakuracho, Koganei City, Tokyo********** | S13016 | 20150629 | C-20090923-C |
4680 | CS009815000003 | Riho Nakata | 1 | Female | 1929-04-08 | 89 | 154-0014 | Shinmachi, Setagaya-ku, Tokyo********** | S13009 | 20150421 | D-20091021-E |
16070 | CS005813000015 | Erika Kanaya | 1 | Female | 1929-04-09 | 89 | 165-0032 | Saginomiya, Nakano-ku, Tokyo********** | S13005 | 20150506 | 0-00000000-0 |
6305 | CS012813000013 | Uno Minami Tomo | 1 | Female | 1929-04-09 | 89 | 231-0806 | Honmoku-cho, Naka-ku, Yokohama-shi, Kanagawa********** | S14012 | 20150712 | 0-00000000-0 |
** ・ It is a method to sort data in Pandas DataFrame / Series.
-Use when you want to sort the information in ascending or descending order.
-'Sort_values (
Recommended Posts