SHARIFAH NAJEHAH BINTI SYED SHAMSUDIN
2020970909
CS2404A
Lab Assignment 2 – Ijazah Farmasi Diiktiraf
1. Import statements. Python modules can get access to code from another module by
importing the file/function using import.
2. Retrieve data from a file.
3. Display name of columns in the file.
4. Display the first 5 data
SHARIFAH NAJEHAH BINTI SYED SHAMSUDIN
2020970909
CS2404A
5. Display the last 5 data
6. Print summary/overview of the dataframe
7. Display some basic statistical details
8. Accessing first 5 elements of Series that contains 'United State Of America'
SHARIFAH NAJEHAH BINTI SYED SHAMSUDIN
2020970909
CS2404A
9. Checking the number of empty rows in the excel file. Then droping the empty rows using
dropna(). Saving it to the excel file.
10. Set default value for each data type
11. Lower all cases and display converted to lower cases
12. Set a column to be unique element
13. Display data
SHARIFAH NAJEHAH BINTI SYED SHAMSUDIN
2020970909
CS2404A
14. Overwriting column with replaced value from 'malaysia' to 'Malaysia'. Case sensitive.
15. Display data after converting to 'Malaysia' case sensitive
16. Made Japan Country as a group and display after converting
17. Made Taiwan country as a group & replace the value using iteration
SHARIFAH NAJEHAH BINTI SYED SHAMSUDIN
2020970909
CS2404A
18. Made 'United Kingdom' Country group & replace the value using iteration
19. Capitalize strings
20. Made Singapore country group & replace the value using iteration
21. Print number of rows using data.shape and format(). Shape[0] is row and shape[1] is
column
SHARIFAH NAJEHAH BINTI SYED SHAMSUDIN
2020970909
CS2404A
22. Use plt.margins(0.20) for data visualization. Axes module of matplotlib library is used to
set or retrieve autoscaling margins.
23. Use sns.barplot(x=country_idx,y=country_val,ax=ax) for data visualization The histogram
shows the top 3 country of the respondents that participated in the survey.