{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "authorship_tag": "ABX9TyNdCOdhTZoyVEu8b/v68Ox4" }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "code", "source": [ "query = \"\"\"\n", "SELECT *\n", "FROM `stockprediction-434721.stock_data.aapl_prices`\n", "WHERE CAST(Date AS DATE) >= DATE_SUB(CURRENT_DATE(), INTERVAL 5 YEAR)\n", "\"\"\"\n", "\n", "apple_df = client.query(query).to_dataframe()" ], "metadata": { "id": "lUR3konIQ-kG" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "apple_df.head(10)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 363 }, "id": "CQdtnEGsS1lY", "outputId": "aecd228f-eb8b-4507-fad5-bf50fe7e527d" }, "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ " Date Open High Low Close \\\n", "0 2020-09-11 00:00:00+00:00 114.570000 115.230003 110.000000 112.0000 \n", "1 2024-04-17 00:00:00+00:00 169.610001 170.649994 168.000000 168.0000 \n", "2 2023-03-24 00:00:00+00:00 158.860001 160.339996 157.850006 160.2500 \n", "3 2024-01-03 00:00:00+00:00 184.220001 185.880005 183.429993 184.2500 \n", "4 2024-05-31 00:00:00+00:00 191.440002 192.570007 189.910004 192.2500 \n", "5 2022-12-15 00:00:00+00:00 141.110001 141.800003 136.029999 136.5000 \n", "6 2021-07-12 00:00:00+00:00 146.210007 146.320007 144.000000 144.5000 \n", "7 2020-04-13 00:00:00+00:00 67.077499 68.425003 66.457497 68.3125 \n", "8 2019-11-04 00:00:00+00:00 64.332497 64.462502 63.845001 64.3750 \n", "9 2023-07-24 00:00:00+00:00 193.410004 194.910004 192.250000 192.7500 \n", "\n", " Adj Close Volume Ticker \n", "0 109.451408 180860300 AAPL \n", "1 167.578476 50901200 AAPL \n", "2 158.999222 59196500 AAPL \n", "3 183.553467 58414500 AAPL \n", "4 192.027725 75158300 AAPL \n", "5 135.228119 98931900 AAPL \n", "6 141.907516 76299700 AAPL \n", "7 66.457993 131022800 AAPL \n", "8 62.292084 103272000 AAPL \n", "9 191.510086 45377800 AAPL " ], "text/html": [ "\n", "
\n", " | Date | \n", "Open | \n", "High | \n", "Low | \n", "Close | \n", "Adj Close | \n", "Volume | \n", "Ticker | \n", "
---|---|---|---|---|---|---|---|---|
0 | \n", "2020-09-11 00:00:00+00:00 | \n", "114.570000 | \n", "115.230003 | \n", "110.000000 | \n", "112.0000 | \n", "109.451408 | \n", "180860300 | \n", "AAPL | \n", "
1 | \n", "2024-04-17 00:00:00+00:00 | \n", "169.610001 | \n", "170.649994 | \n", "168.000000 | \n", "168.0000 | \n", "167.578476 | \n", "50901200 | \n", "AAPL | \n", "
2 | \n", "2023-03-24 00:00:00+00:00 | \n", "158.860001 | \n", "160.339996 | \n", "157.850006 | \n", "160.2500 | \n", "158.999222 | \n", "59196500 | \n", "AAPL | \n", "
3 | \n", "2024-01-03 00:00:00+00:00 | \n", "184.220001 | \n", "185.880005 | \n", "183.429993 | \n", "184.2500 | \n", "183.553467 | \n", "58414500 | \n", "AAPL | \n", "
4 | \n", "2024-05-31 00:00:00+00:00 | \n", "191.440002 | \n", "192.570007 | \n", "189.910004 | \n", "192.2500 | \n", "192.027725 | \n", "75158300 | \n", "AAPL | \n", "
5 | \n", "2022-12-15 00:00:00+00:00 | \n", "141.110001 | \n", "141.800003 | \n", "136.029999 | \n", "136.5000 | \n", "135.228119 | \n", "98931900 | \n", "AAPL | \n", "
6 | \n", "2021-07-12 00:00:00+00:00 | \n", "146.210007 | \n", "146.320007 | \n", "144.000000 | \n", "144.5000 | \n", "141.907516 | \n", "76299700 | \n", "AAPL | \n", "
7 | \n", "2020-04-13 00:00:00+00:00 | \n", "67.077499 | \n", "68.425003 | \n", "66.457497 | \n", "68.3125 | \n", "66.457993 | \n", "131022800 | \n", "AAPL | \n", "
8 | \n", "2019-11-04 00:00:00+00:00 | \n", "64.332497 | \n", "64.462502 | \n", "63.845001 | \n", "64.3750 | \n", "62.292084 | \n", "103272000 | \n", "AAPL | \n", "
9 | \n", "2023-07-24 00:00:00+00:00 | \n", "193.410004 | \n", "194.910004 | \n", "192.250000 | \n", "192.7500 | \n", "191.510086 | \n", "45377800 | \n", "AAPL | \n", "