Python for Citizen Data Scientist

Pandas Example – Write a Pandas program to split a given dataframe into groups and create a new column with count from GroupBy

(Python Example for Beginners)   Write a Pandas program to split a given dataframe into groups and create a new column with count from GroupBy.   Test Data: book_name book_type book_id 0 Book1 Math 1 1 Book2 Physics 2 2 Book3 Computer 3 3 Book4 Science 4 4 Book1 Math 1 5 Book2 Physics 2 …

Pandas Example – Write a Pandas program to split a given dataframe into groups and list all the keys from the GroupBy object

(Python Example for Beginners)   Write a Pandas program to split a given dataframe into groups and list all the keys from the GroupBy object. Test Data: school_code class name date_Of_Birth age height weight S1 s001 V Alberto Franco 15/05/2002 12 173 35 S2 s002 V Gino Mcneill 17/05/2002 12 192 32 S3 s003 VI …

Pandas Example – Write a Pandas program to split the following dataframe into groups based on all columns and calculate GroupBy value counts on the dataframe

(Python Example for Beginners)   Write a Pandas program to split the following dataframe into groups based on all columns and calculate GroupBy value counts on the dataframe.   Test Data: id type book 0 1 10 Math 1 2 15 English 2 1 11 Physics 3 1 20 Math 4 2 21 English 5 …

Pandas Example – Write a Pandas program to split the following dataframe into groups and calculate monthly purchase amount

(Python Example for Beginners)   Write a Pandas program to split the following dataframe into groups and calculate monthly purchase amount.   Test Data: ord_no purch_amt ord_date customer_id salesman_id 0 70001 150.50 05-10-2012 3001 5002 1 70009 270.65 09-10-2012 3001 5005 2 70002 65.26 05-10-2012 3005 5001 3 70004 110.50 08-17-2012 3001 5003 4 70007 …

Pandas Example – Write a Pandas program to split a dataset to group by two columns and then sort the aggregated results within the groups

(Python Example for Beginners)   Write a Pandas program to split a dataset to group by two columns and then sort the aggregated results within the groups. In the following dataset group on ‘customer_id’, ‘salesman_id’ and then sort sum of purch_amt within the groups Test Data: ord_no purch_amt ord_date customer_id salesman_id 0 70001 150.50 2012-10-05 …

Pandas Example – Write a Pandas program to split a dataset, group by one column and get mean, min, and max values by group. Using the following dataset find the mean, min, and max values of purchase amount (purch_amt) group by customer id

(Python Example for Beginners)   Write a Pandas program to split a dataset, group by one column and get mean, min, and max values by group. Using the following dataset find the mean, min, and max values of purchase amount (purch_amt) group by customer id (customer_id). Test Data: ord_no purch_amt ord_date customer_id salesman_id 0 70001 …

Pandas Example – Write a Pandas program to split the following given dataframe into groups based on school code and call a specific group with the name of the group

(Python Example for Beginners)   Write a Pandas program to split the following given dataframe into groups based on school code and call a specific group with the name of the group.   Test Data: school class name date_Of_Birth age height weight address S1 s001 V Alberto Franco 15/05/2002 12 173 35 street1 S2 s002 …

Pandas Example – Write a Pandas program to split the following given dataframe into groups based on school code and class

(Python Example for Beginners)   Write a Pandas program to split the following given dataframe into groups based on school code and class.   Test Data: school class name date_Of_Birth age height weight address S1 s001 V Alberto Franco 15/05/2002 12 173 35 street1 S2 s002 V Gino Mcneill 17/05/2002 12 192 32 street2 S3 …

Pandas Example – Write a Pandas program to split the following dataframe by school code and get mean, min, and max value of age for each school

(Python Example for Beginners)   Write a Pandas program to split the following dataframe by school code and get mean, min, and max value of age for each school.   Test Data: school class name date_Of_Birth age height weight address S1 s001 V Alberto Franco 15/05/2002 12 173 35 street1 S2 s002 V Gino Mcneill …

Pandas Example – Write a Pandas program to split the following dataframe into groups based on school code

(Python Example for Beginners)   Write a Pandas program to split the following dataframe into groups based on school code. Also check the type of GroupBy object.   Test Data: school class name date_Of_Birth age height weight address S1 s001 V Alberto Franco 15/05/2002 12 173 35 street1 S2 s002 V Gino Mcneill 17/05/2002 12 …