Informatics Practices

Write Python code to create the following Series Stock (using list):

1 PEN
2 PENCIL
3 ERASER

Python Pandas

1 Like

Answer

import pandas as pd
items = ['PEN', 'PENCIL', 'ERASER']
Stock = pd.Series(items, index=[1, 2, 3])
print(Stock)
Output
1       PEN
2    PENCIL
3    ERASER
dtype: object

Answered By

2 Likes


Related Questions