0% found this document useful (0 votes)
9 views

Imp Questions 1-1

Uploaded by

harshale13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Imp Questions 1-1

Uploaded by

harshale13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1. Define data science and explain the role of a data scientist in the data science process.

2. Explain the concept of datafication and why it's important in data science.
3. What are the key steps involved in the Data Science process?
4. How can ndarrays be created in NumPy? Illustrate different methods with examples.
5. Explain the following NumPy concepts:
i) ndarray slicing
ii) Boolean indexing
iii) Fancy indexing
6. Discuss the concept of "expressing conditional logic as array operations" in NumPy.
7. Illustrate the 'swap axes' method in NumPy by applying it to a three-dimensional array.
8. Explain the following pandas data structures:
i) Series
ii) Data Frame
iii) Index Objects
9. How does sorting and ranking works in pandas. Provide examples.
10. Describe the process of dropping entries from an axis in pandas.
11. Explain the role of the index in a Series and its importance in data alignment.
12. What is reindexing in pandas? How is it different from regular indexing?
13. Discuss the importance of summarizing and computing descriptive statistics in data
analysis.

14. How to perform reading and writing operations for text format data in CSV files?

Ans: To perform reading and writing operations in text format data using pandas in Python, we
commonly use functions like read_csv and to_csv for CSV (Comma-Separated Values) files.

1. Reading data from CSV format files:

Pandas provides the read_csv()function to read text data into a Data Frame from CSV files.
import pandas as pd

# Reading a CSV file


data = pd.read_csv('filename.csv')
Reading a Tab-delimited Text File:
Also, the data from the text files can be read by specifying the delimiter used in the file.
data = pd.read_csv('filename.txt', delimiter='\t')
2. Writing data to CSV format files:

The to_csv() function is used to write DataFrame data to a CSV or text file.

# Writing the DataFrame to a CSV file


data.to_csv('output.csv', index=False)
This writes the DataFrame to a CSV file without including row indices.
# Writing to a Tab-delimited text file
data.to_csv('output.txt', sep='\t', index=False)

Here, the delimiter is specified as \t (tab character) for a tab-delimited text file.

You might also like