In [23]:
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')
import numpy as np

web_stats={'Day':[1,2,3,4,5,6],
          'Visitors':[43,53,34,45,64,34],
          'Bounce_Rate':[65,72,62,64,54,66]}

df=pd.DataFrame(web_stats)

#print(df)   #df stands for data frame
#print(df.head()) #prints the first 5 rows
#print(df.tail())   #prints the last 5 rows
#Specifying the number in the parentheses gives that number of rows
#print(df.head(2))
#print(df.tail(2))

#df=df.set_index('Day')

#OR you can do this:
df.set_index('Day', inplace=True)
print(df)

#print (df['Visitors']) #prints specific column OR
print (df.Visitors)

#referencing multiple columns
print (df[['Bounce_Rate','Visitors']])

#making a list out of a column; this only work with one column because more than one would
#treat the dictionary like an array, which it isn't
print (df.Visitors.tolist())

#to make it an array
print (np.array(df[['Bounce_Rate','Visitors']]))


     Bounce_Rate  Visitors
Day                       
1             65        43
2             72        53
3             62        34
4             64        45
5             54        64
6             66        34
Day
1    43
2    53
3    34
4    45
5    64
6    34
Name: Visitors, dtype: int64
     Bounce_Rate  Visitors
Day                       
1             65        43
2             72        53
3             62        34
4             64        45
5             54        64
6             66        34
[43, 53, 34, 45, 64, 34]
[[65 43]
 [72 53]
 [62 34]
 [64 45]
 [54 64]
 [66 34]]

In [ ]: