Skip to Main Content

University Library

LibGuides

Basic Data Analysis in Python

This guide will go over how to utilize the Python programming language for basic data analysis.

An Introduction to Integrated Development Environments

Integrated Development Environments (IDEs) are helpful because they provide a visual, all-in-one hub for all your coding needs. While the basic Python prompts are good for quick, single line code testing, IDEs are ideal for longer, more complex code. This is because you can visually see stored variables, errors, and can test immediately, among various other functions you can explore!

PyCharm

                                                                                                     4 Reasons to Use PyCharm for Your Next Python Project | by Julia Di Russo |  Towards Data Science

There are two different ways to install PyCharm. JetBrains, the developers of PyCharm offer free, one-year, renewable subscriptions for students of accredited universities. This will let you install the Professional version of PyCharm, which contains increased functionality, including other programming languages. To do so, click here or the "Apply Now" button on the first link. This will bring you to a form to provide your university email address. Otherwise, they offer a free community edition focused solely on Python that does not require a subscription. Regardless, install

PyCharm and open it. You will be greeted with this screen:

From here, we just need to set up our virtual environment within PyCharm so that we can begin coding. While PyCharm does default to creating its own with an updated version of Python, we can direct it to use our Anaconda environment we set up earlier. First, check your "Location" at the very top. This will be the location on your computer where all of your PyCharm files are saved to. You can change everything after the ...PycharmProjects to customize the name of the project. Next, make sure the "Previously configured interpreter" box is filled in. You may choose to keep the "Create a main.py welcome box" checked if you wish to get an introduction to PyCharm. The picture below shows what your screen should look like.

To the right of the "Previously configured interpreter" box, we can click "Add Interpreter" and then "Add Local Interpreter." This brings up a new window. To the left, select "Conda Environment," and your computer should automatically locate your Anaconda environment. To fix this, we can manually navigate to the conda installation file. Click the folder icon at the end of the "Conda executable" box. From here, navigate to your Anaconda installation file, which should be named conda.bat. This is typically found by opening up the C:\ folder, then the ProgramData folder, then finally the condabin folder. This process will differ slightly if you created a custom virtual environment. Check the Further Learning page for a video tutorial showing that process.

Afterwards, confirm this as your Interpreter and Python will open and begin creating your environment. If asked to install pre-built shared indexes, go ahead and click "Always download." This will speed up the creation of your virtual environment. Regardless, we have a LOT of packages, so it will take a while to fully open PyCharm. Upon opening, you will be greeted by this screen:

While there is a lot to talk about here, we only need to do one more thing to begin coding! On the left hand side, right click your project name. This will open up another window. Mouse over the "New" button, and then click "Python File" in the next new window.

As a note, Python follows its own style guide called PEP-8. This style guide specifies that Python users utilize "snake case" as a standard for basic naming in Python. Essentially this means that most things will be named in all lowercase with underscores between words (i.e. lower_case_example). Practice naming your Python project with this name convention and hit the "Enter" key to open your first PyCharm project!