text_html_output_1.png
from sklearn.linear_model import LinearRegression

from sklearn.model_selection import train_test_split

import pandas as pd

df = pd.read_csv('../input/al-majlis-ai-hackathon-investment/InvestmentDatasetMasked.csv')

df.columns

len(df.columns)

df.describe().T

df.isnull().sum()

df.nunique()

df.dtypes

X = df[['Masked Date', 'col-A1', 'col-A2', 'col-A3', 'col-A4', 'col-B1', 'col-B2', 'col-B3', 'col-B4', 'col-C1', 'col-C2', 'col-C3', 'col-C4', 'col-D1', 'col-D2', 'col-D3', 'col-D4', 'col-E1', 'col-E2', 'col-E3', 'col-E4', 'col-F1', 'col-F2', 'col-F3', 'col-F4', 'col-G', 'col-H', 'col-I', 'col-J', 'col-L', 'col-M', 'col-N', 'col-N1', 'col-O', 'col-P', 'col-Q', 'col-R', 'col-S', 'col-T', 'col-U', 'col-V', 'col-W']]
y = df['col-Predict']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)

lr = LinearRegression()
lr.fit(X_train, y_train)
y_predictions = lr.predict(X_test)

lr.score(X_test, y_test)

predict = pd.read_csv('../input/al-majlis-ai-hackathon-investment-submission/submissionFile.csv')
predict

predict_data = predict.iloc[:, :1]
predict_data

for i in range(1, 42):
    X = df['Masked Date']
    y = df.iloc[:, i]
    X = X.values.reshape(-1, 1)
    lr_predict = LinearRegression()
    lr_predict.fit(X, y)
    predict_value = predict_data.iloc[:, :1]
    predictions = lr_predict.predict(predict_value)
    predict_data[i] = predictions

predict_data.columns = [['Masked Date', 'col-A1', 'col-A2', 'col-A3', 'col-A4', 'col-B1', 'col-B2', 'col-B3', 'col-B4', 'col-C1', 'col-C2', 'col-C3', 'col-C4', 'col-D1', 'col-D2', 'col-D3', 'col-D4', 'col-E1', 'col-E2', 'col-E3', 'col-E4', 'col-F1', 'col-F2', 'col-F3', 'col-F4', 'col-G', 'col-H', 'col-I', 'col-J', 'col-L', 'col-M', 'col-N', 'col-N1', 'col-O', 'col-P', 'col-Q', 'col-R', 'col-S', 'col-T', 'col-U', 'col-V', 'col-W']]

predictions = lr.predict(predict_data)