Memorandum @ Python OR Seminar

I participated in a programming event for the first time on August 23, and another person told me that output is important, so I will write it here.

A summary of libraries that are useful mainly around ipython and when operating operations research.

What is Operations Research

A discipline that solves problems using mathematics.

OR useful libraries

The library used this time is as follows.

Library function
pandas Mainly pre-processing such as cross tabulation. A child who can be unexpected
matplotlib Graph drawing library. It can be pretty clean.
scikit-learn Machine learning library. Most of the methods are included.
pulp Optimization calculation library. This is for light optimization.
simpy Library for simulation. Queue model, etc.
networkX Graph drawing library. This is the graph theory.
sympy Symbol calculation library. It solves the character expression as it is.

I also dealt with a library for AWS called boto, but this time I will omit it.

What is IPython

IPython is like a normal Interactive Shell, A very convenient guy who can set up a server and program from a browser (notebook).

For installation etc., I think that you should refer to other sites.

Start-up

At the seminar, I used the command ʻipython notebook --pylab inline, but it seems that something is not good. ʻIpython notebook --matplotlib inline seems to be a good idea.

By the way, it seems that it can be done even after executing with % matplotlib (inline). ʻInline` selects whether to draw a graph or figure in the browser or in a separate window.

Convenient function

Complement

Press the Tab key to complete it.

Investigation

Add ? to an object or function to get information. You can see the source code by adding ??.

>>> %pylab
>>> prob?
Type:        function
String form: <function prod at 0x10bfeb398>
File:        /usr/local/lib/python2.7/site-packages/numpy/core/fromnumeric.py
Definition:  prod(a, axis=None, dtype=None, out=None, keepdims=False)
Docstring:
Return the product of array elements over a given axis.

Parameters
----------
a : array_like
    Input data.
axis : None or int or tuple of ints, optional...

>>> prob??
Type:        function
String form: <function prod at 0x10bfeb398>
File:        /usr/local/lib/python2.7/site-packages/numpy/core/fromnumeric.py
Definition:  prod(a, axis=None, dtype=None, out=None, keepdims=False)
Source:
def prod(a, axis=None, dtype=None, out=None, keepdims=False):
    """
    Return the product of array elements over a given axis.

    Parameters
    ----------
    a : array_like...

Shell command

Basically, you can do anything by prefixing the shell command with !.

As you know, you can use cd, ls, mv, cp, rm, less, and cat as they are. vim must be ! vim.

command

Some useful ones. % time: Measure the time once. % timeit: Measure the average time multiple times. (Is it better to use this one) % run python_file: Execute python_file. (! Python is also acceptable) % paste: Paste (only when running terminal)

Cheat sheet

Other than those listed here, you should refer to Cheat Sheets.

scikit-learn

pulp in preparation....

simpy in preparation....

networkX in preparation....

sympy in preparation....

Recommended Posts

Memorandum @ Python OR Seminar
Memorandum @ Python OR Seminar: matplotlib
Memorandum @ Python OR Seminar: Pulp
Memorandum @ Python OR Seminar: Pandas
Memorandum @ Python OR Seminar: scikit-learn
Python memorandum
Python Memorandum 2
Python memorandum
python memorandum
Python memorandum
Python memorandum
Python basics memorandum
Python pathlib memorandum
Python memorandum (algorithm)
Python memorandum [links]
Python> list> extend () or + =
Python memorandum numbering variables
python memorandum (sequential update)
Python from or import
Python basic memorandum part 2
[Python] Iterative processing_Personal memorandum
python memorandum super basic
Effective Python Learning Memorandum Day 15 [15/100]
Python 3.4 or later standard pip
Effective Python Learning Memorandum Day 6 [6/100]
Effective Python Learning Memorandum Day 12 [12/100]
Effective Python Learning Memorandum Day 9 [9/100]
Effective Python Learning Memorandum Day 8 [8/100]
About python beginner's memorandum function
[Python] SQLAlchemy error avoidance memorandum
Effective Python Learning Memorandum Day 14 [14/100]
Effective Python Learning Memorandum Day 1 [1/100]
Python bitwise operator and OR
Effective Python Learning Memorandum Day 13 [13/100]
A memorandum about Python mock
Effective Python Learning Memorandum Day 3 [3/100]
Effective Python Learning Memorandum Day 5 [5/100]
[python] Random number generation memorandum
Effective Python Learning Memorandum Day 4 [4/100]
Ruby's `` like Python. 2.6 or later
Python or and and operator trap
Effective Python Learning Memorandum Day 7 [7/100]
Effective Python Learning Memorandum Day 2 [2/100]
python parallel / asynchronous execution memorandum
ABC memorandum [ABC159 C --Maximum Volume] (Python)
Python pywin32 (win32com) Excel operation memorandum
Python
[Python] A memorandum of beautiful soup4
python dict object memorandum (mysterious document)
Run mruby with Python or Blender
ABC memorandum [ABC161 C --Replacing Integer] (Python)
Git & Github & python & VScode Personal memorandum
PIL (Python Imaging Library) installation memorandum
ABC memorandum [ABC158 C --Tax Increase] (Python)
[Python] return A [or / and] B
Memorandum of beginners Python "isdigit" movement
[Python] Use and and or when creating variables
Blender 2.82 or later + python development environment notes
Express Python yield in JavaScript or Java
OR the List in Python (zip function)
Memorandum of python beginners About inclusion notation