avatarJason Feller

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

1238

Abstract

me Python code to retrieve Tesla stock prices from 2022 using Yahoo Finance. I want the output to be in a csv file called ‘stock_prices.csv’ The CSV file mys have a column named “Date” representing the dates and a column named “Price” representing the stock prices.”</p><p id="e110">And then the output will be:</p><figure id="f70f"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*4cgK5TnDtjHmV_MaFnGNCw.png"><figcaption></figcaption></figure><h1 id="df02">Step 2: Copy this code using the botton “copy code” at the top right</h1><h1 id="f854">Step 3: Paste the code in Google Colab</h1><p id="38fa">Navigate to <a href="https://colab.research.google.com/">https://colab.research.google.com/</a> . The create a new notebook by logging in using your Google account.</p><p id="0eee">This is the full code I got from Chat GPT.</p><p id="77be">But remember, you can customise the prompt to get any other stock.</p><div id="eeb1"><pre><span class="hljs-keyword">import</span> yfinance <span class="hljs-keyword">as</span> yf <span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-comment"># Define the stock symbol and the time range for which you want the data</span> sym

Options

bol = <span class="hljs-string">"TSLA"</span> start_date = <span class="hljs-string">"2022-01-01"</span> end_date = <span class="hljs-string">"2022-12-31"</span>

<span class="hljs-comment"># Fetch the stock data using Yahoo Finance</span> stock_data = yf.download(symbol, start=start_date, end=end_date)

<span class="hljs-comment"># Extract the 'Date' and 'Close' columns from the stock data</span> stock_data = stock_data[[<span class="hljs-string">'Close'</span>]].reset_index()

<span class="hljs-comment"># Rename the columns to 'Date' and 'Price'</span> stock_data.columns = [<span class="hljs-string">'Date'</span>, <span class="hljs-string">'Price'</span>]

<span class="hljs-comment"># Save the stock data to a CSV file</span> stock_data.to_csv(<span class="hljs-string">'stock_prices.csv'</span>, index=<span class="hljs-literal">False</span>)

<span class="hljs-built_in">print</span>(<span class="hljs-string">"Stock data saved to 'stock_prices.csv'"</span>)</pre></div><h1 id="dbca">Step 4: Use the CSV file with the stock data</h1><p id="db5f">As simple as that!</p><figure id="4c88"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*lpNgMNRzr3oNIaAX.png"><figcaption></figcaption></figure></article></body>

Practice SQL Online

A Short Resource Guide

Photo by Nubelson Fernandes on Unsplash

LinkedIn recently released its 2023 Most In-Demand Skills list. Unsurprisingly, management, communication, and customer service are among the top 3 soft skills.

Soft skills are great, but somewhat harder to quantify compared to hard skills.

The hard skills list is dominated by software development-related skills. SQL is ranked #2 among the top 10 in-demand hard skills. In today’s data-driven world, you don’t have to be a software developer to use SQL. Many businesses rely on SQL to manage their data and help drive data-driven decisions.

I want to provide you with free resources to practice SQL. I use SQL at my job, but it’s easy to get pigeonholed into specific tasks. When this happens you stop expanding and learning anything new.

Plenty teach it, but few tell us how to practice it. Chances are you learned it, got some online certificate and now it’s collecting digital dust. Or, you’re like me who uses it professionally but wants to learn more.

Websites

  • MySQL Developer Database — This is the equivalent of reading the user manual to your refrigerator. It’s straight from the source. Their website has a plethora of news, information, and learning.

Looking for another SQL language database? Most dialects of SQL have reference manuals on their websites such as MS SQL Server, PostgreSQL, and SQLite.

  • W3schools — W3schools’ reference manual for all SQL languages is easy to use and one of my favorite websites to reference.
  • Hackerrank — Hackerrank is a website that will give you real examples to solve with SQL. Earn points and rewards as you level up your SQL knowledge, and take advantage of the community discussion boards.
  • Kaggle — Kaggle is an online community platform for data scientists. There are many avenues to take here. You can find free datasets, compete in high-paying competitions, or study the work of others. I think the latter is most useful for those still learning SQL. You can dissect the Extract, Transform, Learn (ETL) stage from other people who have used SQL in their projects.
  • SQLzoo — A Wikipedia-style page that also contains quizzes to test your knowledge.
  • Sql-practice.com — SQL-practice is a live IDE environment to write out SQL with existing databases, all within your browser.

Online Learning Platforms

There is much to be said about the value provided by online learning platforms. I won’t go into too much detail, but feel free to look into this list if you want long-form courses. Many of these also provide certificates upon completion. Keep in mind, most of these are paid courses.

  • Coursera
  • Teachable
  • Masterclass
  • Podia
  • Udemy
  • Kahn Academy
  • Udacity
  • Kaggle
  • LinkedIn Learning

Books

People don’t seem to turn to books anymore, but they are still a more than valid resource to learn SQL.

Books can help you understand things in a way that videos or courses cannot, and vice-versa. I recommend using both methods to maximize efficiency.

Extra Bonus (Top Secret)

Don’t tell your recruiter or HR about this one.

LinkedIn Assessments is a way for professionals to showcase their knowledge on their LinkedIn Page. The answers to all of these assessments may or may not be located on GitHub.

Sql
MySQL
LinkedIn
Learning
Resources
Recommended from ReadMedium