CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

Descriptive Statistics (3 Marks Questions)


  1. Consider the following dataframe, and answer the questions given below:
    import pandas as pd
    df = pd.DataFrame({“Quarter1":[2000, 4000, 5000, 4400, 10000],
    "Quarter2":[5800, 2500, 5400, 3000, 2900],
    "Quarter3":[20000, 16000, 7000, 3600, 8200],
    "Quarter4":[1400, 3700, 1700, 2000, 6000]})
    

    • Write the code to find mean value from above dataframedf over the index and column axis. (Skip NaN value)
    • Use sum() function to find the sum of all the values over the index axis.
    • Find the median of the dataframe df.
  2. Given a data frame df1 as shown below:
    Descriptive Statistics (3 Marks Questions)
    • Write command to compute sum of every column of the data frame.
    • Write command to compute mean of column Rainfall.
    • Write command to compute average maxTemp, Rainfall for first 5 rows.
  3. Find the output of the following code:
    import pandas as pd
    data = [{'a': 10, 'b': 20},{'a': 6, 'b': 32, 'c': 22}]
    #with two column indices, values same as dictionary keys
    df1 = pd.DataFrame(data, index=['first', 'second'], columns=['a', 'b'])
    #With two column indices with one index with other name
    df2 = pd.DataFrame(data, index=['first', 'second'], columns=['a', 'b1'])
    print(df1)
    print(df2)

  4. What is Quartile? how it is related to Quantil? How do you generate it in the Python Pandas?

No comments:

Post a Comment