Data Handling Using Pandas - 1 Preeti Arora Class 12 Information Practices Solution


Note :-  Please Click on Question to Answer of that Question !!!







Q1. What is the significance of Pandas Library?


Q2. Name some common data structures of Python's Pandas Library.


Q3. Write shapes of the following ndarrays:

(a) 2468
(b)
2
4
6
(c)
1 2 3 4
5 1 7 8



Q4. What is CSV file?


Q5. What is the use of nrows?


Q6. How can we create CSV file? Explain with an example.


Q7. Create a CSV file with default index.


Q8. Write commands to print the following details of a series object seal.

(a) If the series is empty
(b) Indexes of the series
(c) The data type of underlying data
(d) If the series stores any NaN values



Q9. How do you fill all missing values with previous non-missing values?


Q10. Consider the following tables Item and Customer and answer the questions that follow:

Table: Item

Table: Customer

Assume that the Pandas has been imported as pd.

(a) Create a data frame called dfl for table item.
(b) Create a data frame called dfC for table Customer.
(c) Perform the default join operation on item_ID using two data-frames: dfl and dfC.
(d) Perform the left join operation on item_ID using two data-frames: dfl and dfC.
(e) Perform the right join operation on Item_ID using two data frames: dfi and dfC.
(f) Perform the default operation on Item_ID using two data frames: dfl and dfc with the left index as true.
(g) Perform the outer join operation on item_ID using two data frames: dfl and dfC.
(h) Create a new data frame dfN using data frames: dfl and dfC. The new dataframe data will hold both left index and right index true values.
(i) Arrange the data frame dfN in descending order of Price.
(j) Arrange the Data Frame dfN in descending order of City and Price.




Q11. Consider the following Series object namely S:

0   0.430271
1   0.617328
2   0.265421
3   0.836113
dtype: float 64

What will be returned by the following statements?
(a) S * 100
(b) S > 0
(c) S1 pd.Series (S)
(d) S3 = pd.Series (S1) + 3



Q12. What will be the output produced by the following code?

Stationery = ['pencils', 'notebooks', 'scales', 'erasers']
S = pd.Series ([20, 33, 52, 10], index = Stationery)
S2 = pd.Series ([17, 13, 31, 32], index = Stationery)
print (S = S2)
S = S + S2
print (S + S2)



Q13. What will be the output produced by the following codes, considering the Series object S given above?

(a) print (S[1:1])
(b) print (S[:1])
(c) print (S[0:2])
(d)
S[0:2] =  12
print (S)
(e)
print (S.index)
print (S.values)




Q14. Find the error in the following code fragments:
(a)
S2 = pd. Series ([101, 102, 1-2, 104)]
print (S2.index)
S2.index = [0. 1. 2. 3, 4, 5].
S2 [5] = 220
print (S2)
(b) S = pd.Series (2, 3, 4, 55, index = range (4))
(c) S1 = pd.Series (1, 2, 3, 4, index = range (7))
(d) S2 = pd.Series ([1, 2, 3, 41, index = range (4))



Q15. Find the error:

data = np.array(['a', 'b', 'c', 'd', 'e', 'f'])
s = pd.Series (data, index = [100, 101, 102, 103, 104, 105])
print (s[102, 103, 104])



Q16. Why does the following code cause error?

s1 = pd. Series (range 1, 15, 5), index = list ('ababa')
print (s1 ['ab'])



Q17. Consider the following Class12.csv file containing the data as given below:

Table

(a) Read the CSV file into a data frame df which is stored with tab ("\t") separator.
(b) Write the code to find the total marks (Total_marks) for each student and add it to the newly-created data frame.
(c) Also calculate the percentage obtained by each student under a new column "Average" in the data-frame.



Q18. What do you mean by commit?


Q19. What is the purpose of writing "cursor.execute()"?


Q20. Write a program that reads students marks from a result CSV and displays percentage of each student.


Q21. Write the name of function to store data from a data frame into a CSV file.


Q22. How can we import specific columns from a CSV file?


Q23. What are the advantages of CSV file formats?


Q24. What all libraries do you require in order to bring data from a CSV file into a data frame?


Q25. You want to read data from a CSV file in a data frame but you want to provide your own column names to the data frame. What additional argument would you specify in read_csv()?


Q26. By default, read_csv() uses the value of first row as column headers in data frames. Which argument will you give to ensure that the top/first row's data is used as data and not as column headers?


Q27. Which argument would you give to read.csv() if you only want to read top 10 rows of data?

12 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. please provide all answers ..... around 13 answers are missing...

    ReplyDelete
  2. True please provide

    ReplyDelete
  3. There are total questions 41 only answers of 27 are available sirf please provide other questions answers also

    ReplyDelete
  4. Where can I find the rest of the questions?

    ReplyDelete
  5. Question 17 to 41 of ip book Preeti Arora

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post