Professional Documents
Culture Documents
7 Pandas Assignments
7 Pandas Assignments
3. Drop an index i.e Row3 from data_frame given in question 2, and reset the index
using .reset_index() function.
4. Execute the following command on the data frame given in question number 2
and explain what happens.
df.reset_index().drop_duplicates(subset='index', keep='last').set_index('index')
5. Create a data frame using the given dictionary and remove the rows having
missing values(nan), not more than 2. And reset the index of the data frame.
d={'A':[1,2,np.NaN,5,8,12],
'B':[1,np.NaN,np.NaN,24,12,34],'C':[1,2,3,11,np.nan,17]}
6. Create a data frame using the given function and find unique values and the
number of occurrences of every value in the df.
{"col1":[1,2,3,4],'col2':[444,333,111,444,],'col3':['abc','def','ghi',"xyz"]}
7. Create a data frame from the dictionary given below and perform the given
operations using .groupby() function of pandas.