In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Statistical calculation and description of Pandas
Sample code:
Import numpy as npimport pandas as pddf_obj = pd.DataFrame (np.random.randn (5) 4), columns = ['axiao,' baked, 'cached,' d']) print (df_obj)
Running result:
A b c d0 1.469682 1.948965 1.373124-0.5641291-1.466670-0.494591 0.467787-2.0077712 1.368750 0.532142 0.487862-1.1308253-0.758540-0.479684 1.239135 1.0730774-0.007470 0.997034 2.669219 0.742070 commonly used statistical calculations sum, mean, max, min... Axis=0 statistics by column, axis=1 statistics by row
Skipna excludes missing values. Default is True.
Sample code:
Df_obj.sum () df_obj.max () df_obj.min (axis=1, skipna=False)
Running result:
A 0.605751b 2.503866c 6.237127d-1.887578dtype: float64a 1.46982b 1.948965c 2.669219d 1.073077dtype: float640-0.5641291-2.0077712-1.1308253-0.7585404-0.007470dtype: float64 commonly used statistical description describe produces multiple statistical data
Sample code:
Print (df_obj.describe ())
Running result:
A b c dcount 5.000000 5.000000 5.000000 5.000000mean 0.180305 0.106488 0.244978 0.178046std 0.641945 0.454340 1.064356 1.144416min-0.677175-0.490278-1.164928-1.57455625%-0.064069-0.182920-0.464013-0.08996250% 0.231722 0.127846 0.355859 0.19048275% 0.318854 0.463377 1.169750 0.983663max 1.092195 0.614413 1.328220 1.380601 commonly used statistical description method: the number of non-na values of count describe calculates summary statistics min for Series or each DataFrame column, Max maximum minimum value argmin, argmax minimum / maximum index position idxmin, index value of idxmax minimum / maximum index value quantile calculates the quantile of the sample (0 to 1) sum sum average mean mean median median (50% quantile) mad calculates the variance of the average absolute deviation of the std sample value the skewness of the standard deviation of the skew sample value (third moment) the kurtosis (fourth moment) of the kurt sample value the cumulative sum of cummin, cummin, and cummin of the cumsum sample value Cumulative maximum and minimum values of cummax sample values cumulative product of cumprod sample values diff calculation of first-order difference (useful for time series) pct_change calculation of percentage variation
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.