Python study notes day 52
Pandas installation
The basic environment required to install pandas is Python. Before we start, we assume that you have installed Python and Pip.
Install pandas using pip:
pip install pandas
After the installation is successful, we can import the pandas package to use:
import pandas
Check the installed version
Then we check the installed version
import pandas
print(pandas.__version__ ) # 查看版本
When importing pandas, the alias pd is generally used instead:
import pandas as pd
Installation Verification
Next, let’s try to see if pandas can run normally.
import pandas as pd
mydataset = {
'sites': ["Google", "Facebook", "Wiki"],
'number': [1, 2, 3]
}
myvar = pd.DataFrame(mydataset)
print(myvar)
The result should be:
sites | number | |
---|---|---|
0 | 1 | |
1 | 2 | |
2 | Wiki | 3 |
postscript
What you are learning today is how to install PythonPandas. A summary of today’s learning content:
- Pandas installation
- Check the installed version
- Installation Verification