spyder python

Why Python?

Python is preferred by most data scientists and software developers because of the various functionalities provided by python and the best among those is its open-source feature. Anyone all over the globe can create their own package and make it public for others to use and hence improving the python backend on a daily basis. 

For a user to write a code in python and save it on your desktop an IDE is required. Although to execute codes on your system only requirement is to install python and then access it from windows command prompt. But using an IDE it improves the user’s interactivity with python. An IDE provides the option to write a code in a script and then test the output of the same by running the code in IDE itself and the output is displayed in the output window. If a user wants to understand the working of some specific function, they can refer the help window for documentation inside IDE and user can also try to run single liner codes in the console.

Why Spyder Python?

There are various IDEs in the market to select from such as Spyder, Atom, Pycharm, Pydev etc. Data scientist prefer Spyder among all the different IDEs available and the driving fact behind this is that Spyder was built specifically to be used for data science. Its interface allows the user to scroll through various data variables and also ready to use online help option. The output of the code can be viewed in the python console on the same screen. You can work on different scripts at a moment and then try them out one by one in the same console or different as per your choice all the variables used will be stored in the variable explorer tab. It also provides an option to view graphs and visualizations in the plot window.

Steps to install Spyder

Now moving towards the installation of Spyder. Before installing the IDE a user need to install Python to the system. For using the Spyder IDE install Anaconda to install both Python and Spyder to your system from one link only. Go to https://www.anaconda.com/products/individual to download anaconda based on your system’s configuration. 

Anaconda Installers

Download the installation file and start the installation process by double clicking on the .exe file. Follow the onscreen steps to complete the setup. 

Anaconda Installation
Anaconda Installation
Anaconda Installation
Anaconda Installation
Anaconda Installation

Once the installation is complete you can search for Anaconda Navigator in the search bar and there you can see the option to launch Spyder IDE. Or you can directly search for Spyder in the search bar to open the IDE.

Spyder interface walkthrough

After you open Spyder by default it shows an empty script named temp.py and its default directory is the directory you installed python in. This script can be saved with any custom name and any folder on the system.

Anaconda Installation

Benefits of Spyder

Spyder allows the user to create a create a project which can contain various subfolders or python scripts. To create a file or project, go to the file menu in the menu bar there you can find the option to create a new file or new project.

Menu
Menu

Now let’s deep dive into the Spyder IDE functionality. After writing print the IDE suggests various arguments that can be provided in print functionality such as a value, separator, end etc. Same is the case with all the functions in python and helps the user to write the code easily. 

Menu

Errors

In case there is any syntax error then IDE shows a warning sign next to the line number and also mentions the error in the code hence making it very easy for developer to rectify the error.

Errors

Console

Now suppose while writing a code you might be stuck at any point and are not sure about the output of the single line. You have the option to test the code by copy pasting the code to the command line in console and see the output of the code.

Console

Comments

A comment can be added in a line after some code has been written and the code will run without throwing any error. Spyder also supports multi line comment starting with “““and ending with”””. All the lines written inside these quotes will be non-executable and considered as a comment.

Comments

Variable Explorer

As I have mentioned in the introduction that Spyder comes with a variable explorer which shows all the variables stored in this kernel. Variables can be of any data type int, float, list, tuple, dictionary etc. Any excel file or CSV file or any data source stored in a data frame can also be viewed in the variable explorer.

Variable Explorer

File Explorer

Next comes the file explorer option in the Spyder IDE which allows the user to browse through the files and folders in the working directory. It also allows the user to change the working directory.

FIle Explorer

Modifying the interface

Spyder also allows the user to configure its interface according to their preference. To access the configuration setting go to tools menu and click on preference options. In this preference option you can change the theme of the IDE, syntax colour, font size etc.

Modification Settings

Help and Documentation

Spyder IDE also comes with inbuilt option to access the python documentation. Go to help menu in the menu bar then select required option such as online documentation or ipython documentation or Spyder documentation.

Help and Documentation

Installing packages

As mentioned in the introduction Python consists of various open source packages and modules. The console in Spyder can be used to install such packages directly onto the system. Try using pip install <package_name> in the python console inside Spyder it will install the package to the system. To use this package type import <package name> in the script. Now all the functions in the package can be accessed to write the code.

Installing packages in Spyder Python

Writing your first code

Once you create a new file now let’s begin with writing the code in this file. You can try out a simple code print(“Hello World”) and then click on run button. Output can be seen in the Python console on the right side of the screen.

First Code in Spyder Python

Conclusion

Spyder is considered the most user-friendly IDE by the data scientist because of all the reasons mentioned above. It allows its user to install different packages and modules with a simple command-line code. Easy access to help and documentation also adds a lot of value to its user interface.

This brings us to the end of this blog on Spyder Python. We hope that you found this comprehensive and helpful and were able to gain the required knowledge. If you wish to up-skill and learn more about Python, check out this complete tutorial.

Also, check out the Top 10 uses of Python in Real World and find out the what made it so popular.

0

LEAVE A REPLY

Please enter your comment!
Please enter your name here

sixteen + 13 =