<jupyter_start><jupyter_text>Determine If A Stock Is Under/Over Valued Based on [Determine If A Stock Is Under/Over Valued Using Python Programming](https://www.youtube.com/watch?v=kpK1aXnPrgM) from [Computer Science](https://www.youtube.com/channel/UCbmb5IoBtHZTpYZCDBOC1CA) **Disclaimer:** _Investing in the stock market involves risk and can lead to monetary loss. This material is purely for educational purposes and should not be taken as professional investment advice. Invest at your own discretion._<jupyter_code>import pandas as pd
import numpy as np<jupyter_output><empty_output><jupyter_text>Store the data **GOOG data added manually**<jupyter_code>df = pd.read_csv('InformationTechnologyStocks.csv')<jupyter_output><empty_output><jupyter_text>Show data<jupyter_code>df<jupyter_output><empty_output><jupyter_text>Set tickers as index<jupyter_code>df = df.set_index('Tickers')<jupyter_output><empty_output><jupyter_text>Show data<jupyter_code>df<jupyter_output><empty_output><jupyter_text>Calculate and show the mean P/E ratio<jupyter_code>PE_Ratio_Mean = df.PE_Ratio.mean()
PE_Ratio_Mean<jupyter_output><empty_output><jupyter_text>Calculate and show the Fair Market Value<jupyter_code>df['Fair_Market_Value'] = PE_Ratio_Mean * df['Earnings_Per_Share']<jupyter_output><empty_output><jupyter_text>Show the data<jupyter_code>df<jupyter_output><empty_output><jupyter_text>Calculate and show a companies value ratio to determine if that company is over valued or under valued<jupyter_code>df['Over_Under_Ratio'] = df['Current_Price'] / df['Fair_Market_Value']<jupyter_output><empty_output><jupyter_text>Show the data<jupyter_code>df<jupyter_output><empty_output><jupyter_text>Create a new column to store and show a label of under valued and over valued stocks<jupyter_code>df['Value_Label'] = np.where(df['Over_Under_Ratio'] < 1.0, 'Under Valued', 'Fair or Over Valued')<jupyter_output><empty_output><jupyter_text>Show the data<jupyter_code>df<jupyter_output><empty_output><jupyter_text>Show the percentage that the stock is over or under valued<jupyter_code>df['Value_Percentage'] = abs(df['Over_Under_Ratio'] - 1) * 100<jupyter_output><empty_output><jupyter_text>Show the data<jupyter_code>df<jupyter_output><empty_output><jupyter_text>Show only a list of stocks that are considered under valued<jupyter_code>df[df.Value_Label == 'Under Valued'].index<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10167364016736402, 'fraction_numerical': 0.0037656903765690376, 'mean_word_length': 10.385714285714286, 'pattern_counts': {'":': 0, '<': 62, '<?xml version=': 0, '>': 61, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '15', 'dir': 'jupyter-structured-clean-dedup', 'id': '254239', 'license': 'MIT', 'n_tokens_mistral': 854, 'n_tokens_neox': 825, 'n_words': 169, 'path': 'ComputerScience/DetermineStockIsUnderOverValued/DetermineStockIsUnderOverValued.ipynb', 'repo_name': 'vladiant/AlgorithmicTrading', 'size': '2390'}