DRA Lab Exp1
DRA Lab Exp1
EXPRIMENT-1
NUMPY MODULE FOR RESHAPPING
AIM: To implement python program by using numpy module for reshaping.
SOURCE CODE:
import pandas as pd
import numpy as np
csv_file = 'data.csv'
df = pd.read_csv(csv_file)
print("Original Dataset:")
print(df)
data_array = df.to_numpy()
print(data_array)
# Reshape the NumPy array (example: keeping 5 rows and automatically adjusting columns)
print(reshaped_array)
DATASET DESCRIPTION:
This dataset contains three key environmental measurements: Temperature, Humidity, and
Pressure. These attributes are commonly used in weather analysis and environmental monitoring.
Temperature: The measure of heat in degrees Celsius.
Humidity: The percentage of moisture in the air.
Pressure: The atmospheric pressure measured in hPa (hectopascals).
The data consists of 5 entries, each representing different environmental conditions:
22 45 1012
25 50 1008
21 40 1015
30 55 1005
28 60 1009
OUTPUT:
Original Dataset:
Temperature (°C) Humidity (%) Pressure (hPa)
22 45 1012
25 50 1008
21 40 1015
30 55 1005
28 60 1009
[[ 22 45 1012]
[ 25 50 1008]
[ 21 40 1015]
[ 30 55 1005]
[ 28 60 1009]]
Reshaped Data Array:
[[ 22 45 1012 25 50 1008]
[ 21 40 1015 30 55 1005]
[ 28 60 1009]]
RESULT:
Numpy module for reshaping using Temperature,Humidity and Pressure data set is successfully executed.