Pandas study notes (2) import of pandas and numpy libraries

     In the above, we have configured Anaconda. Since Anaconda comes with Python, the Python environment is also configured. Isn't it particularly convenient? ! Because of the python2.7 version that comes with the Mac itself. But after installing Anaconda, the Mac's default python version will become 3.6. But Anaconda also supports version 2.7, so it doesn't have much impact.

      Next, we're going to start installing the pandas and numpy libraries. In the next chapter, we will start writing our first python commands.

      We first open the terminal Terminal, enter conda, it will display the functions supported by conda


Next, we install numpy, just type conda install numpy. It will automatically check the environment and install all required dependencies. And provide the current version and the latest version.

If you want to test whether numpy is installed successfully, enter python to enter the python interaction (the current default python version will be displayed):


Next, enter import numpy as np. This command has 2 steps: 1. Import the numpy library 2. Name numpy np. For example, if you want to use the array function in numpy later, directly enter np.array()


  This instruction defines a as a one-dimensional array with array elements 1, 2, and 3.

At this point, the numpy library was imported successfully. Next, the pandas library is the same

Type control+z. Exit python.

Enter conda install pandas to install


test:

Enter python to enter python interaction

Enter import pandas as pd to import the library, named pd

>>> import pandas as pd

enter 

a=pd.Series([12,-4,7,9],index=['a','b','c','d'])

output

>>> a

a    12

b    -4

c     7

d     9

dtype: int64


In the next section, we will enter the study of pandas in python