Write a Pandas program to convert a dictionary to a Pandas series.
Sample dictionary: d1 = {'a': 100, 'b': 200, 'c':300, 'd':400, 'e':800}
import pandas as pd d1 = {'a': 100, 'b': 200, 'c':300, 'd':400, 'e':800} print("Original dictionary:") print(d1) new_series = pd.Series(d1) print("Converted series:") print(new_series)
Sample Output:
Original dictionary: {'a': 100, 'b': 200, 'c': 300, 'd': 400, 'e': 800} Converted series: a 100 b 200 c 300 d 400 e 800 dtype: int64
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer