- Consider the DataFrame df below and write the command for the following:
- Find the minimum height of viraj using pivot table.
- Print the name of players in the ascending order of their total run scored.
- Consider the DataFrame df below and write the command for the following:
- Increase weight of all the players with 10kg.
- Find all the players whose weight is more than 50kg.
- Find the players whose runscored is less than average of all the employees.
- Consider DataFrame df as shown above: (command should be single line command)
- a) Write command to calculate minimum value for each of the row from subset of dataframe that contains age, weight, height, runsscored.
- b) Write command to calculate sum of score for rows from 2 to 4.
- c) Find the name of player with runscored is more than 70.
- d) Find the name of players whose weight is more than the average weight of the team.
- Write the code in pandas to create the following dataframes :
df1 df2 mark1 mark2 mark1 mark2 0 10 15 0 30 20 1 40 45 1 20 25 2 15 30 2 20 30 3 40 70 3 50 30
Write the commands to do the following operations on the dataframes given above :- To add dataframes df1 and df2.
- To subtract df2 from df1
- To rename column mark1 as marks1in both the dataframes df1 and df2.
- To change index label of df1 from 0 to zero and from 1 to one.
- Assume data frame DF that contains Data about Payment of parking area with points ‘A1’, ‘A2’, ‘A3’, ‘A4’, ‘A5’ S indexers shown below. give the output of any 4 questions from (i) to (v).
Car type Car Name Parking Slot Payment A1 Hatch Back i10 Block A 2000 A2 Sedan Ciaz Block B 2300 A3 MPV Omini Block D 2500 A4 SUV Scorpio Block C 3000
i) df.CarName ii) df['Status'] = ['Paid', 'Unpaid', 'Paid', 'Unpaid'] iii) df.loc['A1':'A3', "Payment"] iv) df.sort_values("Payment", ascending = False) v) df.drop('A4', axis=0)
Click Here for Solution
name
|
age
|
weight
|
height
|
runsscored
|
|
0
|
mayur
|
15
|
51
|
5.1
|
55
|
1
|
anil
|
16
|
48
|
5.2
|
25
|
2
|
viraj
|
17
|
49
|
5.1
|
71
|
3
|
viraj
|
17
|
51
|
5.3
|
53
|
4
|
mahesh
|
16
|
48
|
5.1
|
51
|
5
|
viraj
|
17
|
59
|
5.3
|
50
|
name
|
age
|
weight
|
height
|
runsscored
|
|
0
|
mayur
|
15
|
51
|
5.1
|
55
|
1
|
anil
|
16
|
48
|
5.2
|
25
|
2
|
viraj
|
17
|
49
|
5.1
|
71
|
3
|
viraj
|
17
|
51
|
5.3
|
53
|
4
|
mahesh
|
16
|
48
|
5.1
|
51
|
5
|
viraj
|
17
|
59
|
5.3
|
50
|
i want answer of 3(C) and 3(d).it's important..please reply fast
ReplyDelete