Pandas Crash Course

in #blog6 years ago

Pandas provides data structures and functionality to quickly manipulate and analyze data. The key to understanding Pandas for machine learning is understanding the Series and DataFrame data structures.
Series

A series is a one-dimensional array where the rows and columns can be labeled.

import numpy as np
import pandas as pd
_array=np.array([1,2,3])
row_name=['a','b','c']
_series=pd.Series(_array,row_name)
print(_series)
2.jpg

DataFrame

A data frame is a multi-dimensional array where the rows and the columns can be labeled.

import numpy as np
import pandas as pd
_array=np.array([[1,2,3],[4,5,6]])
row_name=['a','b']
col_name=['1','2','3']
df=pd.DataFrame(_array,index=row_name,columns=col_name)
print(df)
3.jpg