Basic - Pandas, Numpy -

7385 단어 pandas파이썬numpy

0. Introduction of Numpy



NumPy is a Python package. It stands for 'Numerical Python', and Numpy is a linear algebra library to work with dimensional arrays, which contains useful linear algebra routines and random number capabilities.

1. Numpy arrange() method



The arange() method in the Numpy module in Python is used to generate linear sequence of numbers.
If does it on the basis of the pre-provide starting and ending points along with a constant step size.

Syntax


import numpy as np
start = 1  # default 0
stop = 21
step = 1   # default 1
none = int
np.arange(start, stop, step, dtype=none)

Output


Omit


data = np.arange(start, stop, step)
data

Output


Combination of reshape() method


data = np.arange(start, stop, step).reshape(4,5)
data

Output


Combination of array() method


title = np.array(['UserId', 'SomethingId', 'ProductName', 'Price', 'Ratings'])
df = pd.DataFrame(data, columns=title)
df

Output


Pick up (Slice) specific data


df_part = pd.DataFrame(data[:, 3:], columns=title[3:])
df_part

Output

df_part = pd.DataFrame(data[:, :3], columns=title[:3])
df_part

Output


2. Pandas



Pandas is a library providing fast, flexible, and expressive way to work with a relational or table of data, both easily and intuitive. It allows you to process your data in a way similar to SQL. Scikit-learn is a library of classic machine learning algorithms. It features various classification, regression, and clustering algorithms, including support virtual machines, random force, and a lot more.

concat() method



pandas.concat
df12 = pd.concat([df_part2, df_part1], axis=1)
df12

Output


References:



LINKS

- Numpy-Official
- Pandas-Official
- Python에서 NumPy의 arange 함수를 이용하는 방법을 현역 엔지니어가 해설 【초보자용】
- GitHub : neural-style
- GitHub : Fast Style Transfer in TensorFlow

좋은 웹페이지 즐겨찾기