Commit a629390d authored by Mohamed Naseef's avatar Mohamed Naseef

landanalysis

parent 26d5fa8a
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
brfss_data = np.genfromtxt('tankrelatedarea.csv', dtype=np.int32, delimiter=',', skip_header=1)
print()
print("First Five land of the Data:")
# Indexing starts at 0
print(brfss_data[:5, ])
print("area of the land:", brfss_data.shape)
print()
weight_change = brfss_data[:, 2] - brfss_data[:, 3]
print("Descriptive Statistics for hight from tank:")
# Calculate & display mean for weight change
land_val = np.mean(weight_change)
print("Mean:", land_val.round(decimals=2))
median_val = np.median(weight_change)
print("Median:", median_val)
std_dev_val = np.std(weight_change)
print("Standard Deviation:", std_dev_val.round(decimals=2))
quartile75, quartile25 = np.percentile(weight_change, [75, 25])
iqr_val = quartile75 - quartile25
print("flood affected area hight Range:", iqr_val)
print()
sns.displot(data=weight_change, aspect=2, binwidth=4, color="purple")
plt.xlim(-115, 60)
plt.ylim(0, 7000)
plt.xlabel("areacode Change", fontsize=12)
plt.ylabel("hight", fontsize=12)
plt.show()
plt.figure(figsize=(12, 8))
sns.scatterplot(data=weight_change, color="red", alpha=0.4)
plt.ylabel("area code change", fontsize=12)
plt.show()
brfss_updated = np.column_stack((brfss_data, weight_change))
print("First Five area code hight Changes:")
print(brfss_updated[:5, ])
print("aria :", brfss_updated.shape)
print()
split_arr = [brfss_updated[brfss_updated[:, 5] == k] for k in np.unique(brfss_updated[:, 5])]
print("not affected land:")
print(split_arr[0][:5, ])
print("area:", split_arr[0].shape)
print()
print("Descriptive Statistics for Data relevant land:")
land_mean_val = np.mean(split_arr[0])
print("area:", land_mean_val.round(decimals=2))
land_median_val = np.median(split_arr[0])
print("Median:", land_median_val)
land_std_dev_val = np.std(split_arr[0])
print("Standard Deviation:", land_std_dev_val.round(decimals=2))
e_q75, e_q25 = np.percentile(split_arr[0], [75, 25])
land_iqr_val = e_q75 - e_q25
print("Interquartile Range:", land_iqr_val)
print()
print("not flood area")
print(split_arr[1][:5, ])
print("hight of land:", split_arr[1].shape)
print()
print("area not affect")
e_n_val = np.mean(split_arr[1])
print("high:", e_n_val.round(decimals=2))
fe_me_val = np.median(split_arr[1])
print("Median:", fe_me_val)
tank_std_dev_val = np.std(split_arr[1])
print("Standard Deviation:", tank_std_dev_val.round(decimals=2))
tank_q75, f_q25 = np.percentile(split_arr[1], [75, 25])
e_iqr_val = tank_q75 - f_q25
print("area Range:", e_iqr_val)
print()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment