Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
import numpy as np import pandas as pd from scipy import stats
import numpy as np population = np.arange(1, 101) sample = np.random.choice(population, size=10, replace=False) print("Population Size:", len(population)) print("Sample:", sample)
age = 22 # Integer height = 175.8 # Float gender = "Male" # String is_student = True # Boolean print(age, height, gender, is_student)
nominal = ["Red", "Blue", "Green"] ordinal = ["Low", "Medium", "High"] interval = [-5, 10, 20] ratio = [5, 10, 20] print(nominal)
import pandas as pd df = pd.DataFrame({ "Marks": [70, 80, 90, 85, 95] }) print(df.describe())
import numpy as np marks = [70, 80, 90, 85, 95] print(np.mean(marks))
import numpy as np marks = [70, 80, 90, 85, 95] print(np.median(marks))
from scipy import stats marks = [70, 80, 80, 90, 95] print(stats.mode(marks))
marks = [70, 80, 90, 85, 95] print(max(marks) - min(marks))
import numpy as np marks = [70, 80, 90, 85, 95] print(np.var(marks))
import numpy as np marks = [70, 80, 90, 85, 95] print(np.std(marks))
import numpy as np marks = [70, 80, 90, 85, 95] print(np.percentile(marks, 90))
import numpy as np marks = [70, 80, 90, 85, 95] print(np.percentile(marks, [25, 50, 75]))
from scipy.stats import iqr marks = [70, 80, 90, 85, 95] print(iqr(marks))
import numpy as np data = np.array([10, 12, 14, 16, 100]) Q1 = np.percentile(data, 25) Q3 = np.percentile(data, 75) IQR = Q3 - Q1 lower = Q1 - 1.5 * IQR upper = Q3 + 1.5 * IQR print(data[(data < lower) | (data > upper)])
from scipy.stats import skew data = [10, 12, 14, 16, 100] print(skew(data))
from scipy.stats import kurtosis data = [10, 12, 14, 16, 100] print(kurtosis(data))
import numpy as np x = [1, 2, 3, 4] y = [2, 4, 6, 8] print(np.cov(x, y))
import numpy as np x = [1, 2, 3, 4] y = [2, 4, 6, 8] print(np.corrcoef(x, y))
import pandas as pd df = pd.DataFrame({ "Marks": [60, 70, 80, 90, 95] }) print(df.sample(2))
import numpy as np sample = np.random.choice([10,20,30,40,50], size=3) print(sample.mean())
import numpy as np population = np.random.normal(50, 10, 1000) sample = np.random.choice(population, 30) print(sample.mean())
from scipy import stats import numpy as np data = [10,20,30,40,50] ci = stats.t.interval( confidence=0.95, df=len(data)-1, loc=np.mean(data), scale=stats.sem(data) ) print(ci)
import numpy as np sample = [10,20,30,40] population_mean = np.mean(sample) print(population_mean)
from scipy import stats data = [20,22,19,24,21] result = stats.ttest_1samp(data, popmean=20) print(result)
from scipy import stats data = [20,22,19,24,21] t, p = stats.ttest_1samp(data, 20) print(p)
alpha = 0.05 p_value = 0.03 if p_value < alpha: print("Reject H0") else: print("Fail to Reject H0")
from statsmodels.stats.weightstats import ztest data = [10,20,30,40,50] print(ztest(data, value=30))
from scipy import stats group1 = [10,20,30] group2 = [15,25,35] print(stats.ttest_ind(group1, group2))
from scipy.stats import chi2_contingency table = [ [10,20], [20,30] ] print(chi2_contingency(table))
from scipy.stats import f_oneway group1 = [10,20,30] group2 = [15,25,35] group3 = [18,28,38] print(f_oneway(group1, group2, group3))
import pandas as pd X = pd.DataFrame({ "Age":[20,25,30], "Salary":[30000,50000,80000] }) print(X)
from sklearn.preprocessing import StandardScaler X = [[20],[25],[30]] scaler = StandardScaler() print(scaler.fit_transform(X))
from sklearn.preprocessing import MinMaxScaler X = [[20],[25],[30]] scaler = MinMaxScaler() print(scaler.fit_transform(X))
from scipy.stats import zscore marks = [70,80,90,85,95] print(zscore(marks))
import pandas as pd df = pd.DataFrame({ "Marks":[80,None,90] }) print(df.fillna(df.mean()))
import numpy as np import pandas as pd from scipy import stats from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import MinMaxScaler