Arithmetic
- Object adder -series .add (value)
- Object subtraction -series .sub (value / object)
Logical operation symbol <,>, |, &
- Logical operation symbol <,>, |, & - equivalent to the sql statement where
- It is equivalent to the logic operation numpy
- It returns a Boolean objects (series / df)
- Logical operation function
- df.query () - the equivalent of inquiry
- series.isin (list) --- returns a Boolean series -sql in the in keyword
Statistics operation
describe ()
Comprehensive analysis: the ability to directly draw a lot of statistics, count, mean, std, min , max , etc.
# 计算平均值、标准差、最大值、最小值
data.describe()
Statistics function
min (minimum value), max (maximum), mean (average), median (median), var (variance), std (standard deviation), mode (a mode) Results
Time for a single function to statistics, the axes of these default or according to "columns" (axis = 0, default), if you want to row "index" to specify (axis = 1)
- df.max (axis = 0/1) 0- min sum row column 1-
- df.idxmax (axis = 0/1) - where the maximum value of the index
Cumulative statistical functions
- Observation of the original data is not readily observable information
- series.cumsum-- result is not a return value
Custom operation
df.apply (func, axis)
- func- function
- Calculation of the shaft axis designated
data[['open', 'close']].apply(lambda x: x.max() - x.min(), axis=0)
open 22.74
close 22.85
dtype: float64