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)
Omit
data = np.arange(start, stop, step)
data
Combination of reshape() method
data = np.arange(start, stop, step).reshape(4,5)
data
Combination of array() method
title = np.array(['UserId', 'SomethingId', 'ProductName', 'Price', 'Ratings'])
df = pd.DataFrame(data, columns=title)
df
Pick up (Slice) specific data
df_part = pd.DataFrame(data[:, 3:], columns=title[3:])
df_part
df_part = pd.DataFrame(data[:, :3], columns=title[:3])
df_part
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
df12 = pd.concat([df_part2, df_part1], axis=1)
df12
References:
LINKS
-Numpy-Official
-Pandas-Official
-PythonでNumPyのarange関数を利用する方法を現役エンジニアが解説【初心者向け】
-GitHub : neural-style
-GitHub : Fast Style Transfer in TensorFlow