# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import time

# +
start_array = time.time()

import random

def random_sort(n):
    return sorted([random.random() for i in range(n)])

random_sort(5000000)

end_array = time.time()
print(end_array - start_array)

# +
start_ols = time.time()

from sklearn import datasets 
import statsmodels.api as sm
import numpy as np
import pandas as pd

data = datasets.load_boston()
df = pd.DataFrame(data.data, columns=data.feature_names)

target = pd.DataFrame(data.target, columns=["MEDV"])
X = df[["RM", "LSTAT", "CRIM", "NOX", "INDUS"]]
y = target["MEDV"]

model = sm.OLS(y, X).fit()
predictions = model.predict(X)

end_ols = time.time()
print(end_ols - start_ols)
# -



StarcoderdataJupyterScriptsDedupFiltered