0% found this document useful (0 votes)
2 views1 page

For Code

The document contains a Python function for performing univariate analysis on a pandas DataFrame. It calculates various statistics for a list of quantitative variables, including count, missing values, minimum, quartiles, mean, and maximum. The results are stored in a new DataFrame and printed to the console.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

For Code

The document contains a Python function for performing univariate analysis on a pandas DataFrame. It calculates various statistics for a list of quantitative variables, including count, missing values, minimum, quartiles, mean, and maximum. The results are stored in a new DataFrame and printed to the console.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

import pandas as pd

def univariate_analysis(data: [Link], list_quant: list, list_qual:


list):
"""Univariate analysis avec boucle while"""

print([Link]())

list_var = ['variable', 'count', 'isna', 'min', 'p25', 'mean', 'p75',


'max']
res_quant = []

i = 0
while i < len(list_quant):
x = list_quant[i]
col = data[x]

tmp = [
x,
[Link](),
[Link]().sum(),
[Link](),
[Link](0.25),
[Link](),
[Link](0.75),
[Link]()
]

res_quant.append(tmp)
i += 1

res_quant = [Link](res_quant, columns=list_var)

print("QUANTITATIVE Variable RES")


print(res_quant)

return [res_quant]

You might also like