Pandas Series
A Pandas Series is a one-dimensional labeled array capable of holding data of any type (integer, string, float, Python objects, etc.). The axis labels are collectively called indexes.
The Pandas Series is nothing but a column in an Excel sheet. Labels need not be unique but must be of a hashable type.
The object supports both integer and label-based indexing and provides a host of methods for performing operations involving the index.
Creating a Series
Pandas Series is created by loading the datasets from existing storage (which can be a SQL database, a CSV file, or an Excel file).
Pandas Series can be created from lists, dictionaries, scalar values, etc.
Example: Creating a series using the Pandas Library.
Python3
import pandas as pd import numpy as np # Creating empty series ser = pd.Series() print ( "Pandas Series: " , ser) # simple array data = np.array([ 'g' , 'e' , 'e' , 'k' , 's' ]) ser = pd.Series(data) print ( "Pandas Series:\n" , ser) |
Output
Pandas Series: Series([], dtype: float64)
Pandas Series:
0 g
1 e
2 e
3 k
4 s
dtype: object
For more information, refer to Creating a Pandas Series
Pandas Introduction
Pandas is a powerful and open-source Python library. The Pandas library is used for data manipulation and analysis. Pandas consist of data structures and functions to perform efficient operations on data.
This free tutorial will cover an overview of Pandas, covering the fundamentals of Python Pandas.
Table of Content
- What is Pandas Libray in Python?
- What can you do using Pandas?
- Getting Started with Pandas
- Data Structures in Pandas Library
- Pandas Series
- Pandas DataFrame
- How to run the Pandas Program in Python?