In [ ]:
import pandas as pd
import numpy as np
In [ ]:
obj = pd.Series([1,3,4,5,6,7,8,9])
obj
In [ ]:
# You can define a custom index for series data
obj_c = pd.Series([1,2,4], index=['a','b','c'])
obj_c
In [ ]:
df_1 = pd.DataFrame(np.random.randint(0,100,size=(100,4)), columns=list('ABCD'))
print(type(df_1))
df_1.head()
In [ ]:
df_1.tail(3)
In [ ]:
df_1.index
In [ ]:
df_1.columns
In [ ]:
df_1.values
In [ ]:
df_1.describe()
In [ ]:
df_1.mean()
In [ ]:
df_1
In [ ]:
df_1['A']
In [ ]:
df_1[0:3]
Pandas can read and write to a multitude of file formats
In [ ]:
import time
t_start = time.time()
apple_df = pd.read_csv('https://raw.githubusercontent.com/matplotlib/sample_data/master/aapl.csv')
t_end = time.time()
print (t_end - t_start)
apple_df.head()
In [ ]:
apple_describe_time_start = time.time()
apple_df.describe()
apple_describe_time_end = time.time()
In [ ]:
print (apple_describe_time_end - apple_describe_time_start)
In [ ]:
# pd.set_eng_float_format(accuracy=2, use_eng_prefix=True)
apple_df.mean()