How to get pandas on PyCharm

Use PyCharm for Python programming

Updated March 17, 2021

After the blog posts on the use of Sublime Text and Visual Studio Code for Python programming, now follows - with PyCharm - the presentation of a complete IDE (Integrated Development Environment). While Sublime Text and Visual Studio Code are versatile editors, PyCharm therefore focuses on Python programming.

JetBrains, the developer studio behind PyCharm, provides three different versions for download. In addition to the paid Professional Edition, there is also a free one Community Edition, which should be sufficient for many applications. The PyCharm website provides an overview of the differences between these two editions. In addition, members of an educational institution can use the Educational Edition use.

Download and install PyCharm

The desired edition (for macOS, Linux or Windows 10) can be downloaded from the download page. An ARM version is also available for Macs with Apple's M-Chips. You can also install PyCharm or any other JetBrain product using the JetBrains Toolbox App perform.

The first launch of PyCharm

After starting PyCharm for the first time, you have to make some basic settings, such as keyboard layout, appearance or the use of additional plugins. Then - as with every future start - the welcome window opens.

This window is divided into two areas. On the left there is a sidebar with four buttons:

  • Projects
  • Customize
  • Plugins
  • Learn PyCharm

The appearance on the right side depends on which button you have selected. The default is Projects active. The recently used projects are then listed on the right-hand side. After the first start, it only says “Nothing to show”. Above it there are three buttons that can be used to either start a new project, open a local project or establish a connection to a repository in order to download a project from there.

Is Customize selected, you get the possibility to adjust the appearance and the keyboard layout again. Standard font sizes can also be defined here.

Plugins opens the Marketplace, via which further plugins can be downloaded and installed. The "Installed" tab shows the plugins installed so far.

If you need help, you should Learn PyCharm to be selected. Apart from a PyCharm course, there are links to other help pages and tutorials here.

Start a new project

A click on "New Project" opens the window in which a new project can be started.

In this window you first select the storage location and a name for the new project. Then you can create a new virtual environment (using Virtualenv, Pipenv or Conda) or continue without a virtual environment. Then you just have to select the Python interpreter to be used.

In this example I continue without a virtual environment and choose Python 3.9 as the interpreter.

Configure PyCharm

If you are using PyCharm for the first time, you will first want to take a look at the settings. The call is made via via

or the key combination + (macOS).

As you can see from the list in the left column, there are numerous configuration options. It can therefore be useful to enter a search term in the search field. For example, if the font needs to be adjusted, entering "Font" will help.

The font can be configured for a wide variety of elements. Do you want them for the editor set, must

to be selected. The selection made is saved by clicking on “Apply”.

If you want to change the interpreter or get an overview of the installed packages, a click on helps

further. Here you can also quickly get an overview of new package versions (in the “Latest version” column).

The editor

The main work area is the editor. If you specified when creating a new project that the "main.py" file should be created, you will receive a corresponding file with the following example code:

To the left of

there is a green arrow. Clicking on this opens a context menu with the options

  • Run 'main'
  • Debug 'main' and
  • Modify Run Configuration

"Run" executes the program. In the window that opens below the editor,

issued.

The debugger is started by clicking on “Debug”. In this case, the execution of the code is interrupted in line 9. Because at this point - indicated by a red dot - a Breakpoint set. Incidentally, this can be removed again by clicking on the red dot. The debugger window now opens below the editor window.

Since the execution of the code is stopped in line 9, the line with the function, the value of the corresponding variable appears under "Variables" (together with the data type):

Incidentally, “Run” and “Debug” can also be executed using the buttons at the top right of the editor window.

A click on “MAIN” also enables “Edit Configurations” to be called up. Adjustments can then be made in the "Run / Debug Configurations" window that opens. The path to the file to be executed can be found here (here: "main.py"). In addition, under “Parameters” you can specify whether any arguments should be passed.

And those were the basics of PyCharm. You can now delete the example code and start writing your own Python application. Have lots of fun with it!

Related Links

Categories ProgrammingTags PyCharm, Python