-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathscript.py
More file actions
32 lines (26 loc) · 771 Bytes
/
script.py
File metadata and controls
32 lines (26 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import pandas as pd
import numpy as np
"""
The code is an example of pandas series
Pandas Series can be generated with a list, Dictionary, numpy array etc
"""
# Pandas Series with List.
data = [2010, 2011, 2012, 2013, 2014]
index = ['Nigeria', 'Gabon', 'Mali', 'Africa', 'South Africa']
print(pd.Series(data, index))
# Pandas with Dictionary
print('\n')
data_index = {'Nigeria': 2010,
'Gabon': 2011,
'Mali': 2012,
'Africa': 2013,
'South Africa': 2014}
print(pd.Series(data_index))
# Pandas with Numpy Array
print('\n')
data = np.arange(2010, 2016)
print(pd.Series(data))
"""
The Code below is an example of Pandas Dataframe
DataFrames in Pandas is simply combination of series that shares the same index.
"""