Library (19) 썸네일형 리스트형 [time/timeit] Measure the time efficiency of the code 1. What is Algorithm Analysis? An algorithm is a generic, step-by-step list of instructions for solving a problem. It is a method for solving any instance of the problem such that given a particular input, the algorithm produces the desired result. Algorithm analysis is concerned with comparing algorithms based on upon the amount of computing resources that each algorithm uses. We can measure th.. [requests] Interacting with Web Pages 1. What is HTTP and requests module? HTTP stands for Hyper Text Transfer Protocol. WWW is about communication between web clients and servers. Communication between client computer and web servers is done by sending HTTP requests and receiving HTTP Response. The requests module allows us to send HTTP requests using Python. The HTTP requests returns a Response object with all the response data(co.. [unittest] Unit Testing Our Code 1. What is Unit Testing? Unit testing is a method for testing software that looks at the smallest testable pieces of code, called units, which are tested for correct operation. By doing unit testing, we can verify that each part of the code, including helper functions may not be exposed to the user, works correctly and as intended. # calc.py def add(x, y): """Add Function""" return x + y def sub.. [pandas] Optimizing DataFrame's Memory 1. Estimating the amount of memory The Pandas DataFrame.info() method provides information on non-null counts, dtype, and memory usage of data frames. The memory_usage='deep' keyword can confirm more accurate memory usage. import pandas as pd df = pd.read_csv('file.csv') df.info(memory_usage='deep') 1.1 Pandas BlockManager The Pandas's BlockManager Class optimizes data by type and stores it sepa.. [os] User Underlying Operating System 1. What is OS Module? The OS module provides a portable way of using operating system dependent functionality. 2. Importing OS module import os # check all attributes and methods print(dir(os)) 3. Useful methods of OS module # Get current working directory print(os.getcwd(), '\n') # Change working direcotry os.chdir('...') # List directory : List all files and directory in current working direct.. [numpy] Processing Datasets, Boolean, and Datatypes in Numpy 1. Datasets in Numpy 1.1 Load csv file into ndarray The numpy.genfromtxt() method stores numeric data inside a text file in ndarray. import numpy as np file = np.genfromtxt('file.csv', delimiter=',') fisrt_five = file[:5,:] The result stored in the ndarray is denoted by scientific notation and nan. np.nan stands for not a number and means character data inside a csv file. In addition, since each.. [numpy] Arithmetics with Numpy Arrays 1. Basic Arithmetics 1.1 Adding values The ndarray with the same length generate new ndarrays by adding elements of each index. In Python's case, the numpy packages is much more efficient in terms of algebric operations because the elements for each list must be extracted and added. The reason why the numpy object is much faster than the Python list that the numpy package is written in the C lan.. [numpy] Basic operations of Numpy array 1. What is Numpy? Numpy is a general-purpose array-processing package. It provides a high-performance multidimensional array object and tools for working with these arrays.The Numpy is an abbreviation for Numpy Python and is a Python package used in algebric calculations. import numpy as np 2. Array 2.1 Creating an Array object Numpy's core data structure is ndarray, which has a similar structur.. [collections] Make frequency table automatically 1. What is the collections library? The Python library collections implements specialized container datatypes providing alternatives to Python's general purpose built in containers, dict, list, set, and tuple. The Counter method provide dict subclass for counting hashable objects. When we pass a string or list to the Counter constructor as a factor, an object is returned that tells us how many t.. [chardet] Encoding and Representing Text 1. What is Encoding? Encoding is a processing or processing method that converts the form or form of encoding information, and in the case of character encoding, it is a method of encoding a set of characters. Since the computer does not accept number other than 0 and 1, encoding is required to express chracters. ASCII encoding has 128 characters codes. In the case of ASCII encdoing, in addition.. [csv] Read files 1. What does csv library do? The Python's library called csv allows data from various format to be imported in our program. 2. How to use it? 2.1 Open files one by one First, open the file we want using open buillt-in function. And then, make reader object using reader method from csv library. We should close the file we open after we make reader obejct. The final data we will use will be stored.. [Sklearn] Modules 1. What is Scikit-Learn? Scikit-learn(Sklearn) is the most useful and robust library for machine learning in Python. It provides a selection of efficient tools for machine learning and statistical modeling including classification, regression, clustering and dimensionality reduction via a consistence interface in Python. This library, which is largely written in Python, is build upon Numpy, Scip.. [plotly] Getting Started with Plotly in Python 1. What is Plotly? The plotly Python library is an interactive, open-source plotting library that supppors over 40 unique chart types covering a wide range of statistical, financial, geographic, scientific, and 3-dimensional use-cases. plotly also enables Python users to create beautiful interactive web-based visualization that can be displayed in Jupyter notebooks, saved to standalone HTML file.. [pandas] Set options Pandas has an options API configure and customize global behavior related to DataFrame display, date behavior and more. The most using options for dataframe are below : import pandas # Max column views pd.options.display.max_columns = 999 # Suppress scientific notation pd.set_option('display.float_format', lambda x: '%.5f' % x) [folium] Visualization Map on Python 1. What is Folium? Folium makes it easy to visualize data that's been manipulated in Python on an interactive leaflet map. It enables both the binding of data to a map for choropleth visualizations as well as passing rich vector/raster/HTML visualizations as markers on the map. 2. How to use Folium Step 1 : Import library folium import folium Step 2 : Set the center of map's frame To start map w.. [heapq] Implementing Binary Heap in Python 1. What is Binary Heap? A Binary Heap is a heap, a tree which obeys the property that the root of any tree is greater than or equals to all its children. The primary use of such a data structure is to implement a priority queue. 2. Implementing Binary Max Heap class PriorityQueue: def __init__(self): self.queue = [] def _heapify(self, n, i): largest = i l = 2 * i + 1 r = 2 * i + 2 if l < n and s.. [queue] Implementing Priority Queue in Python 1. What is Priority Queue? A Priority Queue is a special type of queue in which each element is associated with a priority value. And, elements are served on the basis of their priority. Generally, the value of the element itself is considered for assigning the priority. For example, the element with the highest value is considered the highest priority element. 2. Implementing Priority Queue cla.. [beautifultable] Print List in Table Format 1. What is BeautifulTable? This package provides BeautifulTable Class for easily printing tabular data in a visually appealing format to a terminal. Features included but not limited to : Full customization of the look and the feel of the table Build the table as you wish, by adding rows, or by columns or even mixing both these approaches. Full support for colors using ANSI sequences or any libr.. [beautifulsoup] Web Scraping 1. What is Web Scraping Web Scraping, Web Harvesting, Web Extraction is data scraping used for extracting data from websites. The web scraping software may directly access the World Wide Web using the Hyper Transfer Protocol or a web browser. While web scraping can be done manually by a software user, the term typically refers to automated processes implemented using a bot or web scraper 2. How .. 이전 1 다음