Numpy learning record
Application of time date correlation - datetime64
numpy.busday_offset
(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) First adjusts the date to fall on a valid day according to the roll rule, then applies offsets to the given dates counted in valid days.
This function is used to determine wheth ...
Posted by bongbong on Fri, 04 Mar 2022 23:40:13 +0100
Detailed summary of numpy usage: This article is enough to learn how to use numpy
Import numpy and view version
import numpy as np
np.__version__
'1.13.1'
What is numpy?
That is, Numeric Python. After expansion, python can support array and matrix types, including a large number of matrix and array calculation functions
Numpy framework is the basis of machine learning and data mining. pandas, scipy and matplotli ...
Posted by luckybob on Thu, 24 Feb 2022 08:43:55 +0100
NumPy: understanding broadcasting
brief introduction
The broadcast describes how NumPy calculates the operation between arrays of different shapes. If it is a larger matrix and a smaller matrix, the smaller matrix will be broadcast to ensure the correct operation.
This article will explain in detail the use of broadcast in NumPy with specific examples.
Basic broadcasting ...
Posted by Syto on Thu, 10 Feb 2022 17:16:54 +0100
nndl01_numpy exercises
numpy exercises
This article is only for my study notes and is deleted
The title comes from https://github.com/nndl/nndl.github.io
array operation of numpy
1. Import numpy Library
import numpy as np
2. Create a one-dimensional array A and initialize it to [4,5,6], (1) output the type of a, (2) output the size of each dimension of a, (3) ...
Posted by lbraine on Wed, 09 Feb 2022 15:41:34 +0100
Index of numpy array
introduction
Array index refers to the use of square brackets ([]) to index a set of values. The most familiar indexing method is single element indexing. In addition, this paper will also introduce the index method of array slice, as well as index array, Boolean index group and structure index tool.
1. Single element index
Note: the sta ...
Posted by flunn on Wed, 09 Feb 2022 11:37:38 +0100
Go from Python to Numpy
Vectorization of code means that the problem to be solved is vectorized in essence. It only needs some numpy skills to make the code run faster, but vectorization is not very easy.
Vectorization code example: game of life
The universe of life game is a two-dimensional orthogonal grid. Each grid (cell) is in two possible states, life or death. ...
Posted by dirtyfrenchman on Wed, 02 Feb 2022 13:33:56 +0100
Pandas: deeply understand the data structure of pandas
brief introduction
This article will explain the basic data types Series and DataFrame in Pandas, and explain in detail the creation, indexing and other basic behaviors of these two types.
To use Pandas, you need to reference the following lib:
In [1]: import numpy as np
In [2]: import pandas as pd
Series
Series is a one-dimensional ...
Posted by AstroTeg on Tue, 01 Feb 2022 01:34:12 +0100
Python data processing and analysis design a high return portfolio (return on investment and risk analysis) task 2: calculate the returns of different types and portfolios
Article catalog
1. Learning objectives
2. Operation explanation
3. Job results
1. Learning objectives
Understand simple and logarithmic returnsCalculate the return on investment for different stocks through Pandas and NumPyCalculate the return of the portfolio by linear summation
2. Operation explanation
Starting from this task, we wi ...
Posted by Tsukiyomi on Thu, 27 Jan 2022 09:27:56 +0100
numpy/pandas 10min understand pandas
preface
Viewing official documents is the most effective way to learn: https://pandas.pydata.org/pandas-docs/stable/user_guide/10min.html#selection Only the relevant content of '10min to understand pandas' is posted here for review and consolidation. It is said that numpy and pandas are the basis of python data analysis. You must master th ...
Posted by hannnndy on Mon, 24 Jan 2022 15:26:35 +0100
Introduction to Python data analysis pandas ------ ten minute introduction pandas
1, Import common libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
2, Create object
(1) By passing a list to create a Series, pandas will create an integer index by default
The code is as follows:
s = pd.Series([1, 3, 5, np.nan, 6, 8])
print(s)
The operation results are as follows:
0 1.0
1 3.0
...
Posted by johncox on Sun, 23 Jan 2022 13:40:58 +0100