<jupyter_start><jupyter_text>Insert Model Here<jupyter_code>daysToShift = 1

def modelShiftDays(days):
    new_df = returns.shift(days, axis=0)
    return new_df

# new dataframe after shift
df_pred = modelShiftDays(daysToShift)

df_pred.head()<jupyter_output><empty_output><jupyter_text>Plotting Data<jupyter_code># For the first listed stock:

# create dataframe for all given days
df = pd.DataFrame()
df['actual'] = returns[returns.columns[0]]
df['predicted'] = df_pred[returns.columns[0]]
df['date'] = returns.index
df.reset_index(drop=True, inplace = True)
df.head()

sns.lineplot(data=df, x='date', y='actual')
sns.lineplot(data=df, x='date', y='predicted')
sns.lineplot(data=df, x='actual', y='predicted').set_title('Predicted vs Actual')
# For the first listed stock:

# create dataframe with all relevant data for first 30 days
df = pd.DataFrame()
df['actual'] = returns[returns.columns[0]].iloc[:30]
df['predicted'] = df_pred[returns.columns[0]].iloc[:30]
df['date'] = returns.index[:30]
df.reset_index(drop=True, inplace = True)
df.head()

sns.lineplot(data=df, x='date', y='actual')
sns.lineplot(data=df, x='date', y='predicted')
sns.lineplot(data=df, x='actual', y='predicted').set_title('Predicted vs Actual')<jupyter_output><empty_output><jupyter_text>Testing for Multiple Stocks<jupyter_code>stock = df_pred.iloc[:30, 4]
stock
daysToShift = 1

# new dataframe after shift
df_pred = modelShiftDays(daysToShift)

df_pred.head()

numStocks = 10
for i in range(numStocks):
    #stock = df_pred.iloc[:30, i]
    #pred_list[name] = stock
    
    # create dataframe with all relevant data for first 30 days
    df_actual = pd.DataFrame()
    df_actual['actual'] = returns[returns.columns[i]].iloc[:30]
    df_actual['date'] = returns.index[:30]
    df.reset_index(drop=True, inplace = True)
    sns.lineplot(data=df_actual, x='date', y='actual')
    
df_actualreturn = pd.DataFrame()
df_actualreturn = returns[returns.columns[0:numStocks]].iloc[:30]
df_actualreturn
for i in range(numStocks):
    #stock = df_pred.iloc[:30, i]
    #pred_list[name] = stock
    
    # create dataframe with all relevant data for first 30 days
    df_p= pd.DataFrame()
    df_p['predicted'] = df_pred[returns.columns[i]].iloc[:30]
    df_p['date'] = returns.index[:30]
    df.reset_index(drop=True, inplace = True)
    sns.lineplot(data=df_p, x='date', y='predicted')
    
df_predreturn = pd.DataFrame()
df_predreturn = df_pred[returns.columns[0:numStocks]].iloc[:30]
df_predreturn<jupyter_output><empty_output><jupyter_text>Getting Top Returns<jupyter_code>maxValuesObj = df_predreturn.max(axis=1)
Stock = df_predreturn.idxmax(axis=1)
print('Top Returns Per Day')
print(maxValuesObj, Stock)<jupyter_output>Top Returns Per Day
date
1990-01-02         NaN
1990-01-03         NaN
1990-01-04    5.000000
1990-01-05    3.454545
1990-01-08    1.531023
1990-01-09    3.405405
1990-01-10    1.639344
1990-01-11    0.406250
1990-01-12    2.022989
1990-01-15   -1.004823
1990-01-16    0.434028
1990-01-17    8.620690
1990-01-18    0.000000
1990-01-19    2.086895
1990-01-22    1.438435
1990-01-23    0.000000
1990-01-24    4.332756
1990-01-25    3.418414
1990-01-26    1.630674
1990-01-29    1.652174
1990-01-30    2.202899
1990-01-31    1.617021
1990-02-01    6.026786
1990-02-02    1.946903
1990-02-05    2.857143
1990-02-06    1.785714
1990-02-07    2.816901
1990-02-08    5.357143
1990-02-09    1.595968
1990-02-12    2.796421
dtype: float64 date
1990-01-02       NaN
1990-01-03       NaN
1990-01-04    904261
1990-01-05    923024
1990-01-08    921795
1990-01-09    929813
1990-01-10    936365
1990-01-11    904261
1990-01-12    905270
1990-01-15    902355
1990-01-16    921795
1990-01-17    936365
1990-01-18   [...]
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.17445314609775858, 'mean_word_length': 4.032608695652174, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '291178', 'license': 'MIT', 'n_tokens_mistral': 1853, 'n_tokens_neox': 1473, 'n_words': 283, 'path': 'baseline-model/baseline_model original.ipynb', 'repo_name': 'anjali-chauhan/dc_stock_portfolio_generator', 'size': '3703'}