Posts

Showing posts from January, 2024

Data Analysis using Python(NEP)

CSV FILE ARE GIVEN END!!!  1.Probability a:Calculating the simple probabilities import pandas as pd df = pd.read_csv( 'train.csv' ) probability_event = df[ 'Survived' ].value_counts() / len (df[ 'Survived' ]) print (probability_event) [note: use csv file according your choice and change Survived as per the csv file] b:Applications of Probability distributions to real life problems (A): Normal Distribution import numpy as np import matplotlib . pyplot as plt mean = 0 std_dev = 1 sample_size = 1000 random_sample = np . random . normal ( mean , std_dev , sample_size ) plt . hist ( random_sample , bins = 30 , density = True , alpha = 0.75 , color = 'blue' ) xmin , xmax = plt . xlim () x = np . linspace ( xmin , xmax , 100 ) p = ( 1 / ( std_dev * np . sqrt ( 2 * np . pi ))) * np . exp ( - ( x - mean ) ** 2 / ( 2 * std_dev ** 2 )) plt . plot ( x , p , 'k' , linewidth = 2 ) plt . title ( "Normal Distribution"...