Python Programming Workshop-Super Introductory Python Execution Environment

Before the main subject


Positioning / premise

This article was prepared for the ** In-house Workshop **. Therefore, please understand that we will proceed on the following assumptions.


Purpose of this workshop

The purpose is to allow participants to ** stand at the entrance where they can self-study as needed **.


How to proceed with the workshop

The workshop basically focuses on hands-on. (Some explanations are included)


Caution

This workshop is expected to be ** 60-120 minutes **. Therefore, we do not do ** systematic learning ** because we do not have enough time for full-scale learning.

In order to be able to create the program you want from scratch in earnest, you need to study by yourself or take some kind of course.


target

This workshop is mainly aimed at the following participants.

Please note that there are many things that I do not dare to mention because I do not deal with intermediate and advanced people at all.


Preparing the programming environment

Please see here.


Today's goal

After reviewing what you learned up to the last time, you will be able to execute it in various environments.

Etosetora


1. Python interpreter


Python interpreter

Run the following command:

python

Reference: 2. Using the Python interpreter — Python 3.8.2 documentation


practice


  1. Jupyter Notebook

Jupyter Notebook installation

Install the Jupyter Notebook by running the following command: (Administrator authority required)

pip install jupyter

Start Jupyter Notebook

ipython notebook

Or

jupyter notebook

Jupyter Notebook practice


3. Handle CSV files freely


Preparation / installation for handling CSV files

Run the following command to install the module. (Administrator authority required)

pip install pandas

Download the sample CSV file from here.

Census time series data Main time series data in CSV format|File|Find statistical data|General counter for official statistics

Import and view CSV files

import pandas

csv = pandas.read_csv('sample.csv')
print(csv)

Practice working with CSV files

  1. Display only the top 10 lines
  2. Display only 10 lines from the bottom
  3. Display only the prefecture name and population (total) columns.

Reference information


Answers to practice working with CSV files

Save the following contents with the file name "csv_import.ipynb" and execute it with Jupyter Notebook.

csv_import.ipynb


{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#CSV processing part 1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Data import"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas\n",
    "\n",
    "csv = pandas.read_csv('sample.csv')\n",
    "print(csv)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#Data display"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(csv.head(10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(csv.tail(10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(csv['Name of prefectures'], csv['Population (total)'])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}

At the end

This time, I tried to make a workshop packed with many so that Python can be executed in various environments.

The programming / execution environment is an important factor. I hope you will use it as a basis for your future learning.

Next time, I will try various data processing using pandas introduced this time. It's about time that we can really use it for our business!

In addition, although there are many parts where the explanation is broken, please be patient as it is for beginners.

If you would like to continue learning, please make a request.


official


Python reference site


Python related books

Recommended Posts

Python Programming Workshop-Super Introductory Python Execution Environment
Python Programming Workshop-Super Introductory Vol.3
Competitive programming with python Local environment settings
Python programming note
Python environment construction
python environment settings
python windows environment
Environment construction (python)
Programming in python
python environment construction
Python --Environment construction
Python environment construction
python environment construction
Prepare the execution environment of Python3 with Docker
Simply build a Python 3 execution environment on Windows
[Python] Create an asynchronous task execution environment + monitoring environment
Introduction to Python "Re" 1 Building an execution environment
Create a Python execution environment on IBM i
Build PyPy and Python execution environment with Docker
Build a python execution environment with VS Code
[Python] Get environment variables
My python environment memo
Function execution time (Python)
python windows environment construction
3. 3. AI programming with Python
homebrew python environment construction
Use Python installed with pyenv for PL / Python execution environment
Python development environment construction
Competitive programming diary python 20201213
python virtual environment Pipenv
Python programming with Atom
Competitive programming diary python 20201220
About Python development environment
Output python execution time
virtual environment in python
Python environment with docker-compose
python2.7 development environment construction
Python programming in Excel
LEGO Mindstorms 51515 Python Programming
Create a Python environment
Development environment in Python
[Python] Dynamic programming ABC015D
Building a Python environment for programming beginners (Mac OS)
Mac environment construction Python
Competitive programming diary python
Programming with Python Flask
Virtual environment with Python 3.6
Python environment construction @ Win7
[Python] Chapter 01-02 About Python (Execution and installation of development environment)
Python environment for projects
Python Basic Course (3 Python Execution)
Python + Anaconda + Pycharm environment construction
Programming with Python and Tkinter
Python3 programming functions personal summary
Python execution time measurement memo
Atcoder Acing Programming Contest Python
Install Python environment with Anaconda
[Python] Dynamic programming knapsack problem
Manage python environment with virtualenv
[Python] Dynamic programming TDPC D
Python environment construction (Windows10 + Emacs)