Data Structure in Python Pandas

Pandas deals with the following three data structures −

  1. Series

  2. DataFrame

  3. Panel

What is a Series?

A series is a one-dimensional data structure. It can have any data structure like integer, float, and string. It is useful when you want to perform computation or return a one-dimensional array. A series, by definition, cannot have multiple columns.                                          For example, the following series is a collection of integers 10, 23, 56, ...

pd.Series([1, 2, 3, 4])
0    1
1    2
2    3
dtype: int64	


What is  DataFrame?

DataFrame is a two-dimensional array with heterogeneous data. For example,

import pandas as pd   

data = {'Name':['A', 'B', 'C', 'D], 'Age':[11, 34, 19, 23]} 
# Create DataFrame 
df = pd.DataFrame(data) 
# Print the output. 


Total Views: 482