Home >Backend Development >Python Tutorial >Calculation of simple statistics in Python
The content of this article is about the calculation of simple statistics in Python. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
1. These operations must ensure that the Anaconda integrated library has been installed on the computer. If an error occurs after installation, you can uninstall python in the original computer and reinstall Anaconda. It is recommended to install it during installation. Directly check Add environment variables, otherwise you will have to add environment variables yourself in the future. In the compiler in Pycharm, select python in the Anaconda installation folder. Create a new data folder in Pycharm to store data files.
2. Open the Python Console.
3. First use python to read the data. You need to first enter import pandas as pd to introduce the pandas package, then enter df=pd.read_csv("./data/CityData.csv") to read the data, and finally Enter df to display data.
4. Enter type(df) and type(df["cid"]) respectively to find that the two data types are different.
16.Similarly, we can input ss.chi2 and ss.t to get the chi-square distribution and T distribution respectively.
17. In addition, we can also perform sampling, enter df.sample(n=10) to extract 10 samples from the data, enter df. sample(frac=0.1) takes a 10% sample from the data.
The above is the detailed content of Calculation of simple statistics in Python. For more information, please follow other related articles on the PHP Chinese website!