Question No 1. Create a DataFrame with the following data and find its .shape
, .size
, .ndim
, .dtypes
, .columns
, .index
, and .values
.
data = { 'Product': ['Laptop', 'Tablet', 'Smartphone'],
'Price': [1200, 300, 800],
'Quantity': [10, 20, 15]}
Quesrion No 2) Create a DataFrame with at least 5 rows and 4 columns of your choice. Write Python code to:
- Display the shape of the DataFrame.
- Display the number of dimensions.
- Show the data types of each column.
- Print the row and column labels.
- Display the DataFrame as a NumPy array.
Question No 4) For the DataFrame created change the column labels to ['Item', 'Cost', 'Stock'] and check the
.columns
attribute again.
0 Comments
Please do note create link post in comment section