[Python] 100 knocks on data science (structured data processing) 017 Explanation

Youtube Video commentary is also available.

problem

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.

answer

code


df_customer.sort_values('birth_day', ascending=True).head(10)

output

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

Commentary

** ・ 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 ()' is a function that sorts the specified character string in ascending or descending order. -In this case, since birth_day is sorted in ascending order (= sorted in chronological order), it is described as'sort_values ('birth_day', ascending = True)'. ** **

Recommended Posts

[Python] 100 knocks on data science (structured data processing) 018 Explanation
[Python] 100 knocks on data science (structured data processing) 030 Explanation
[Python] 100 knocks on data science (structured data processing) 022 Explanation
[Python] 100 knocks on data science (structured data processing) 017 Explanation
[Python] 100 knocks on data science (structured data processing) 026 Explanation
[Python] 100 knocks on data science (structured data processing) 016 Explanation
[Python] 100 knocks on data science (structured data processing) 024 Explanation
[Python] 100 knocks on data science (structured data processing) 027 Explanation
[Python] 100 knocks on data science (structured data processing) 029 Explanation
[Python] 100 knocks on data science (structured data processing) 015 Explanation
[Python] 100 knocks on data science (structured data processing) 028 Explanation
"Data Science 100 Knock (Structured Data Processing)" Python-007 Explanation
"Data Science 100 Knock (Structured Data Processing)" Python-006 Explanation
"Data Science 100 Knock (Structured Data Processing)" Python-001 Explanation
"Data Science 100 Knock (Structured Data Processing)" Python-002 Explanation
[Python] Data Science 100 Knock (Structured Data Processing) 021 Explanation
"Data Science 100 Knock (Structured Data Processing)" Python-005 Explanation
"Data Science 100 Knock (Structured Data Processing)" Python-004 Explanation
[Python] Data Science 100 Knock (Structured Data Processing) 020 Explanation
[Python] Data Science 100 Knock (Structured Data Processing) 025 Explanation
"Data Science 100 Knock (Structured Data Processing)" Python-003 Explanation
[Python] Data Science 100 Knock (Structured Data Processing) 019 Explanation
[Python] Data Science 100 Knock (Structured Data Processing) 001-010 Impressions + Explanation Link Summary
Try "100 knocks on data science" ①
Getting started with Python with 100 knocks on language processing
Preparing to try "Data Science 100 Knock (Structured Data Processing)"
Challenge 100 data science knocks
Data science 100 knock (structured data processing) environment construction (Windows10)
Data Science Cheat Sheet (Python)
[Python] Notes on data analysis
That's why I quit pandas [Data Science 100 Knock (Structured Data Processing) # 2]
That's why I quit pandas [Data Science 100 Knock (Structured Data Processing) # 1]
That's why I quit pandas [Data Science 100 Knock (Structured Data Processing) # 3]
That's why I quit pandas [Data Science 100 Knock (Structured Data Processing) # 5]
That's why I quit pandas [Data Science 100 Knock (Structured Data Processing) # 4]
That's why I quit pandas [Data Science 100 Knock (Structured Data Processing) # 6]
Start data science on the cloud
Image processing with Python 100 knocks # 3 Binarization
Image processing with Python 100 knocks # 2 Grayscale
I took Udemy's "Practical Python Data Science"
[Python] Various data processing using Numpy arrays
Image processing with Python 100 knocks # 7 Average pooling
Video processing using Python + OpenCV on Mac
Image processing with Python 100 knocks # 9 Gaussian filter
Books on data science to read in 2020
Periodically execute Python Script on AWS Data Pipeline
[Data science memorandum] Handling of missing values ​​[python]
Try importing MLB data on Mac and Python
TensorFlow: Run data learned in Python on Android
Run Python on Apache to view InfluxDB data
100 language processing knocks 03 ~ 05
100 language processing knocks (2020): 40
100 language processing knocks (2020): 32
[Python] Challenge 100 knocks! (015 ~ 019)
python image processing
100 language processing knocks (2020): 47
Python on Windows
twitter on python3
100 language processing knocks (2020): 22
100 language processing knocks (2020): 26
100 language processing knocks (2020): 34