Data Sci
Data Sci
Write a NumPy program to create a null vector of size 10 and update sixth value to 11
b. Write a NumPy program to convert an array to a float type
c. Write a NumPy program to create a 3x3 matrix with values ranging from 2 to 10
NumPy array
d. Write a NumPy program to find the real and imaginary parts of an array of complex
numbers
Expected Output:
XYZ
0 78 84 86
1 85 94 97
2 96 89 96
3 80 83 72 4 86 86 83
4. Write a Pandas program to select the specified columns and rows from a given data frame.
Sample Python dictionary data and list labels:
Select 'name' and 'score' columns in rows 1, 3, 5, 6 from the following data frame.
'qualify': ['yes', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes']} labels
= ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
Expected Output:
qualify b
9.0 no d
NaN no f
20.0 yes g
14.5 yes
5. Write a Pandas program to count the number of rows and columns of a DataFrame.
Sample Python dictionary data and list labels:
'qualify': ['yes', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes']} labels
= ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
Expected Output:
Number of Rows: 10
Number of Columns: 4
6. Reading data from text files, Excel and the web and exploring various commands for
doing descriptive analytics on the Iris data set
7. Use the diabetes data set from Pima Indians Diabetes data set for performing the
following:
• Frequency
• Mean,
• Median,
• Mode,
• Variance
• Standard Deviation
9. Use the diabetes data set from Pima Indians Diabetes data set for performing the
following:
10. Apply and explore various plotting functions on UCI data set for performing the
c) Three-dimensional plotting
11. Apply and explore various plotting functions on UCI data set for performing the
following: a) Correlation and scatter plots
b) Histograms
c) Three-dimensional plotting
12. Apply and explore various plotting functions on Pima Indians Diabetes data set for
a) Normal values
c) Three-dimensional plotting
13. Apply and explore various plotting functions on Pima Indians Diabetes data set for
b) Histograms
c) Three-dimensional plotting
Original DataFrame
0147
1258
2 3 6 12
3491
4 7 5 11
Number of columns:
15. Write a Pandas program to group by the first column and get second column as lists in
rows
Sample data:
Original DataFrame
col1 col2
0 C1 1
1 C1 2
2 C2 3
3 C2 3
4 C2 4
5 C3 6
6 C2 5
col1
C1 [1, 2]
C2 [3, 3, 4, 5]
C3 [6]
16. Write a Pandas program to check whether a given column is present in a DataFrame or
not. Sample data: Original DataFrame col1 col2 col3
0147
1258
2 3 6 12
3491
4 7 5 11
17. Create two arrays of six elements. Write a NumPy program to count the number of
instances of a value occurring in one array on the condition of another array.
Sample Output:
Original arrays:
Number of instances of a value occurring in one array on the condition of another array:
18. Create a 2-dimensional array of size 2 x 3, composed of 4-byte integer elements. Write a
NumPy program to find the number of occurrences of a sequence in the said array.
Sample Output:
[[1 2 3]
[2 1 2]]
Sequence: 2,3
19. Write a NumPy program to merge three given NumPy arrays of same shape
20. Write a NumPy program to combine last element with first element of two given ndarray
with different shapes.
Sample Output:
Original arrays: