Confusion with Predicting The Stock Market Guided Project

Screen Link:
https://app.dataquest.io/m/65/guided-project%3A-predicting-the-stock-market/1/the-dataset

Hi. I am currently in the Predicting the Stock Market Guided Project and am terribly confused with the interface. As you can see below, all that I want to do is see the first few rows of my data set. However, since there is no “run” button, I do not know how to do this. I assume that I need to do something in the terminal view, but don’t know how to accomplish that. The instructions tell me that if I am confused with the interface, I should complete this guided project. However, in trying to complete that guided project I run into the same issue as before, since I do not know how to run my code.

import pandas as pd

sp = pd.read_csv("sphist.csv")

sp.head()

What am I supposed to do to run this code? Thank you for the help.

2 Likes

Hello @mjs139,

  1. Switch to the terminal tab
  2. Move to the folder where your python script is located, using the cd command. you can read more about moving in and out of folders in the terminal here.
    For example, your predict.py script is in the scripts folder, so you run cd scripts.
  3. When you are in the script folder, type python predict.py in the terminal to run your predict.py script file.
    Generally, to run a python script in the terminal, you use python followed by the name of the python script including its extension.

Lastly, use the print() function as in print(sp.head()) to display the first few rows.

image

I hope this helps.

2 Likes

You can click on the Terminal tab, and then run the python script.

You can see the tab next to that Editor one, like below -

And once in the Terminal, make sure you are in the same folder as the python script and run -

python predict.py

If you are not yet comfortable with using the CLI, then I would also recommend going through all the command line related Missions in the Data Analyst in Python Path.

1 Like

Thank you so much for the help. I understand now.

1 Like

Dear Team,

I am having problems completing this Guided project: Predicting the stock market. A couple of observations:

Its seems somewhat random that this is a project in the command line interface, a course that i completed ages ago, i would have expected the project to be in the usual jupyther notebook format

Secondly, the solution above does not seem to work for me. How can one complete the project in the command line interfae?

looking forward to your response

1 Like