Financial Bigdata and Python
1. Introduction
Mathematics, Jeonggyu Huh ' 1
Programming
Act of writing a command algorithm in a language that allows it to communicate with a computer
programming machine
language language 1010110 …
compiler
storage memory CPU
stores code and data Data and code are allocated processes instructions
Mathematics, Jeonggyu Huh ' 2
Diffi Perfor Versat Fitness for Developm
Language Note
culty mance ility finance ent year
C B A B C 1972 simple but high performance
object-oriented language
C++ C A A A 1983
(main language for finance)
garbage collector
JAVA B B A C 1991
(developers' main language)
high-productivity and
Python A C A A 1989
general-purpose language
R A C C B 1990 specialization in statistics
specialization in
MATLAB A C C B 1984
math/engineering
Recommended programming language for finance : Python, C++
Mathematics, Jeonggyu Huh ' 3
The popularity of ‘Python’ is improving day by day (currently #1 in TIOBE index)
Rank Language Ratings
1 Python 16.41% ▪ #1 by PYPL (#2: Java)
2 C 10.21% ▪ #2 by RedMonk (#1: JavaScript)
3 C++ 9.76%
16 MATLAB 1.11%
『Apr 2024』
Mathematics, Jeonggyu Huh ' 4
Article Title Press Date
Python craze in recruitment and vocational training Apple Economy 2020.2.25
How long will Python be popular? Byline Network 2020.3.17
Why Python is attracting attention as a next-generation language Coding World 2019.7.26
Countdown to the end of life of Python 2 that dominates the AI ecosystem GDNet Korea 2020.1.20
Julia vs Python... What is the best data language? CIO Korea 2019.7.12
Python is the most preferred programming language for engineers. GDNet Korea 2019.9.9
Unbelievable growth, about the innovation that Python will lead in the future CIO Korea 2019.5.18
Math and Python data analysis you must know IT news 2019.12.27
Python's popularity is at an all-time high... Overtake Java and C in 3 or 4 years CIO Korea 2019.6.10
Anyone can analyze data with Python UPI news 2019.6.14
The three most popular deep learning
frameworks are all based on Python.
TensorFlow Keras PyTorch
Mathematics, Jeonggyu Huh ' 5
Life is short, You need Python.
No other language is as easy to learn,
yet as versatile and productive as Python.
Program development trend
python
bottleneck
C++
Mathematics, Jeonggyu Huh ' 6
Guido van Rossum
▪ How was ‘Python’ created?
It was made by Guido van Rossum (1956-)
because he was just bored (!) on Christmas in 1989.
▪ Where did the name Python come from?
If you look up an English dictionary, it says it's a kind of snake.
But, according to the creator, regardless of this,
it was just named after his favorite British comedian group (Monty Python).
Nevertheless, the mark of Python comes from the shape of a snake.
Monty Python
Python (a kind of snake)
Python logo
Mathematics, Jeonggyu Huh ' 7
Features of Python
1) Interpreter Language
One can run your code immediately without compiling it.
On the other hand, languages such as C and C++ require a compilation process.
Because it does not require compilation, it is highly flexible, such as trying various tests easily.
The disadvantage is that the execution speed is relatively slow compared to other languages.
* compiled language *
source code execution
compile execution
file
for j in range(0,2) : *order* × 2 *translation*
do *order*
*translation* *order*
* interpreted language *
*order*
source code execution *order*
*translation*
for j in range(0,2) :
do *order*
*order*
Mathematics, Jeonggyu Huh ' 8
Features of Python
2) automatic memory management
Computer memory is broadly divided into heap and stack. By default, data and code are
allocated on the stack, but data that requires a lot of memory are allocated on the heap.
Memory allocated on the heap must be returned for the next operation when the variable is no
longer needed. Languages such as C and C++ require the user to perform this series of
processes themselves. In languages such as Python and Java, the garbage collector performs
memory management on behalf of the user.
heap messy pile
b
allocate/
release
c memory o
a
r
programmer garbage collector
space for variables that require a lot of memory
a stack neatly arranged pile
b c
default space for variables
Mathematics, Jeonggyu Huh ' 9
Features of Python
3) dynamic type language
In static type languages such as C, C++, Java, when declaring a variable, the data type must be
written as shown below.
int a = 0; float b = 3.414; string c = “hello! world”;
However, in a dynamic type language like Python, there is no need to specify the data type.
a = 0; b = 3.414; c = “hello! world”;
* type error
a=c
static type: An error occurred because an attempt was made to assign a string to an integer variable.
dynamic type: The variable a is automatically converted from an integer variable to a string variable.
a+c
static type: An error occurred because an attempt was made to add a string to an integer variable.
dynamic type: Same as for static type.
Dynamic type languages are convenient because you don't have to worry about the types of
variables, but always be aware that bugs can occur due to type errors!
Mathematics, Jeonggyu Huh ' 10
Features of Python
4) A powerful ecosystem for data science
Data processing library
Statistics library pandas
statsmodels
Machine Learning Linear algebra library
scikit-learn (Deep Learning x) library
numpy
Google's deep
tensorflow learning library Numerical analysis library
scipy
A good deep learning
keras library for beginners
Data visualization library
Development environment matplotlib
jupyter in a web browser
Facebook's deep
pytorch learning library
Mathematics, Jeonggyu Huh ' 11
How do I install Python?
1) Install each package after installing Python (python.org)
▪ After installing only Python, packages are each installed using pip.
▪ Python 2 is supported until 2020. You must use Python 3.
▪ Most computers are 64-bit systems
(32-bit and 64-bit refer to the amount of space for memory addresses)
▪ So, if you are not using Mac or Linux, you can download the 64-bit Windows
version of Python 3.
2) Install python and packages at once with anaconda (anaconda.com) python.org
▪ Install python and required packages at once with anaconda
▪ Not all required packages are installed (eg, PyTorch)
▪ If you're not using a Mac or Linux, you can also get Anaconda
for the 64-bit Windows version of Python 3.
▪ Anaconda allows you to create multiple Python virtual environments on a
single computer. It is growing in popularity in line with the recent trend of
utilizing high-end servers.
numpy 1.5 numpy 1.2
scipy 1.7 scipy 1.8
torch 1.2 tensorflow 2
anaconda.com
Mathematics, Jeonggyu Huh ' 12
Mathematics, Jeonggyu Huh ' 13
Run Jupyter Notebook
Mathematics, Jeonggyu Huh ' 16
① click
② click
Mathematics, Jeonggyu Huh ' 17
Run by entering +
shift enter
Or click
Mathematics, Jeonggyu Huh ' 18
stop running reset run all cells
Mathematics, Jeonggyu Huh ' 19
Click to change the file name to the desired one
save file
Mathematics, Jeonggyu Huh ' 20
After programming, exit via the menu button..
Mathematics, Jeonggyu Huh ' 21
It provides a Python development environment that is almost like that of Jupyter Notebook.
As a result, data analysis using Python is possible even if anaconda installation fails.
Google CoLab https://colab.research.google.com (Google ID required)
Mathematics, Jeonggyu Huh ' 22
integrated with Google Drive
Some of Google's GPU resources are available
(The devices are suitable for deep learning)
Mathematics, Jeonggyu Huh ' 23
Run jupyter as administrator
Mathematics, Jeonggyu Huh ' 24
pip : python package manager
!: The entered command is sent to the OS.
e.g.) !ls : shows the contents of the current directory
• pip list
checks the list of packages installed on the system
• pip install <package name>
installs the entered package
• pip install –-upgrade <package name>
upgrades the entered package
• pip uninstall < package name >
removes the entered package
Mathematics, Jeonggyu Huh ' 25
Mathematics, Jeonggyu Huh ' 26
It is recommended to install the package
after adequately checking the package installation guide.
Mathematics, Jeonggyu Huh ' 27