python 복습(4) - 머신러닝 딥러닝 맛보기
·
Python
1. 머신러닝 소개¶ 2. 데이터 전처리¶ In [1]: import seaborn as sns import pandas as pd import matplotlib.pyplot as plt In [2]: df = sns.load_dataset('titanic') - 상위 5개 데이터 확인 In [3]: df.head() Out[3]: survived pclass sex age sibsp parch fare embarked class who adult_male deck embark_town alive alone 0 0 3 male 22.0 1 0 7.2500 S Third man True NaN Southampton no False 1 1 1 female 38.0 1 0 71.2833 C F..
python 복습(2) - 데이터 전처리
·
Python
데이터 프레임 생성¶ In [ ]: import pandas as pd Dict 를 통한 데이터 프레임 생성 In [ ]: df = pd.DataFrame({'a': [1, 2, 3], 'b' : [4, 5, 6], 'c' : [7, 8, 9]}) In [ ]: type(df) Out[ ]: pandas.core.frame.DataFrame In [ ]: df Out[ ]: a b c 0 1 4 7 1 2 5 8 2 3 6 9 In [ ]: dummy = {'a': [1, 2, 3], 'b' : [4, 5, 6], 'c' : [7, 8, 9]} In [ ]: df2 = pd.DataFrame(dummy) In [ ]: ..
python 복습(1) - 기초
·
Python
1. 파이썬의 특징¶ 세미콜론(;)으로 끝을 맺지 않아도 됩니다. In [1]: print('Hello World!') Hello World! In [2]: print('Hello World!'); Hello World! 들여쓰기에 주의가 필요합니다. In [3]: 1 + 1 Out[3]: 2 In [4]: 1 + 1 Out[4]: 2 In [5]: 1 + 1 1 + 1 Out[5]: 2 In [6]: 1 + 1 1 + 1 File "", line 2 1 + 1 ^ IndentationError: unexpected indent 주석은 #(한 줄), 또는 ''', """로 만들 수 있습니다. In [7]: # 한줄짜리 주석입니다. """ 이렇게 여러줄을 주석처리 할 수 있습니..
19. Pandas_DataProcessingAndAnalysis_complete
·
Python
Introduction to Pandas¶The pandas library is a framework for data processing and analysis in Python. It provides convenient data structures for representing series and tables of data, and makes it easy to transform, split, merge, and convert data. Features for handling data: labeled indexing hierarchical indices alignment of data for comparison and merging of datasets handling of missing data an..
18. Introduction to GUI Programming with Tkinter
·
Python
Introduction to GUI Programming with Tkinter¶ In [ ]: import sys import tkinter as Tk Geometry Managers¶ Grid¶ see https://tkdocs.com/tutorial/grid.html In [ ]: help(Tk.Label.grid) In [ ]: class GridExample: def __init__(self, parent): self.parent = parent # first row self.l1 = Tk.Label(self.parent, text="Entry 1: ") self.e1 = Tk.Entry(self.parent) self.l1.grid(row=0, column=0) self.e1.grid(row=..
17. Object-Oriented Programming
·
Python
Object-Oriented Programming¶Introduction¶In Python, you can use functions by themselves, in what is called a procedural programming approach. While a procedural style can suffice for writing short, simple programs, an object-oriented programming (OOP) approach becomes more valuable the more your program grows in size and complexity. Advangates of OOP: Encapsulation to improve modularity and reus..
16. Classes
·
Python
Classes¶ Classes are the fundamental concept for object oriented programming. A class defines a data type with both data and functions that can operate on the data. An object is an instance of a class. Each object will have its own namespace (separate from other instances of the class and other functions, etc. in your program). Simplest example: just a container (like a struct in MATLAB) In [1]:..
15. scipy-optimization
·
Python
Optimization¶ In [1]: import math import numpy as np %matplotlib inline import matplotlib.pyplot as plt from IPython.display import Image The optimization problem is to find maxima and minima of an objective function. Optimization is often referred to as minimization, because maximization can be formulated as minimizing its negative value. Optimization is closely related to root finding: because..
14. scipy-basics
·
Python
In [1]: import math import numpy as np %pylab inline %pylab is deprecated, use %matplotlib inline and import the required libraries. Populating the interactive namespace from numpy and matplotlib Integration¶ We'll do some integrals of the form $$I = \int_a^b f(x) dx$$ In [2]: from scipy import integrate integrate? Type: module String form: File: c:\users\win10hx64\appdata\local\programs\python\..
13. Linear Algebra
·
Python
In [1]: import math import numpy as np %pylab inline %pylab is deprecated, use %matplotlib inline and import the required libraries. Populating the interactive namespace from numpy and matplotlib Linear Algebra¶ General Manipulations of Matrices¶ You can use regular NumPy arrays or you can use a special matrix class that offers some short cuts. In [2]: a = np.array([[1.0, 2.0], [3.0, 4.0]]) In [..