In [2]:
import pandas as pd
In [2]:
ice_cream = ["Chocolate", "Vanilla", "Strawberry", "Rum Raisin"]
pd.Series(ice_cream)
Out[2]:
In [3]:
lottery = [7, 20, 9, 10, 17, 12]
pd.Series(lottery)
Out[3]:
In [ ]:
In [4]:
books = {"It" : "Stephen King", "The Collector" : "John Fowles", "A Game Of Thrones" : "George R. R. Martin", "Sugar Blues" : "William Dufty"}
pd.Series(books)
Out[4]:
In [6]:
b = pd.Series(books)
b
Out[6]:
In [7]:
b.values
Out[7]:
In [8]:
b.index
Out[8]:
In [9]:
b.dtype
Out[9]:
In [ ]:
In [12]:
prices = [2.99, 4.45, 1.36]
s = pd.Series(prices)
s
Out[12]:
In [13]:
s.sum()
Out[13]:
In [14]:
s.product()
Out[14]:
In [16]:
s.mean()
Out[16]:
In [17]:
s.min()
Out[17]:
In [18]:
# Dificulty - Easy, Medium, Hard
# Volume - 1 through 10
# Subtitles - True / False
In [21]:
fruits = ["Apple", "Orange", "Grape", "Strawberry", "Mango"]
weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
pd.Series(data=fruits, index=weekdays)
Out[21]:
In [22]:
fruits = ["Apple", "Orange", "Grape", "Strawberry", "Mango", "Watermelon"]
weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Monday"]
pd.Series(data=fruits, index=weekdays)
Out[22]:
In [6]:
pokemon = pd.read_csv("pokemon.csv", usecols=["Pokemon"], squeeze=True)
pokemon
Out[6]:
In [8]:
pd.read_csv("google_stock_price.csv", squeeze=True)
Out[8]:
In [10]:
pokemon = pd.read_csv("pokemon.csv", usecols=["Pokemon"], squeeze=True)
google = pd.read_csv("google_stock_price.csv", squeeze=True)
In [17]:
pokemon.head(9)
Out[17]:
In [18]:
google.tail(10)
Out[18]:
In [3]:
pokemon = pd.read_csv("pokemon.csv", usecols=["Pokemon"], squeeze=True)
google = pd.read_csv("google_stock_price.csv", squeeze=True)
In [21]:
pokemon.is_unique
Out[21]:
In [22]:
google.is_unique
Out[22]:
In [23]:
pokemon.ndim
Out[23]:
In [24]:
pokemon.shape
Out[24]:
In [4]:
pokemon = pd.read_csv("pokemon.csv", usecols=["Pokemon"], squeeze=True)
google = pd.read_csv("google_stock_price.csv", squeeze=True)
In [16]:
pokemon.sort_values(ascending=False).tail()
Out[16]:
In [17]:
pokemon.sort_values(ascending=True, kind="mergesort").head()
Out[17]:
In [18]:
pokemon = pd.read_csv("pokemon.csv", usecols=["Pokemon"], squeeze=True)
google = pd.read_csv("google_stock_price.csv", squeeze=True)
In [19]:
google.head(3)
Out[19]:
In [21]:
google.sort_values().head(3)
Out[21]:
In [22]:
google = google.sort_values()
In [24]:
google.head(3)
Out[24]:
In [26]:
google.sort_values(ascending=False, inplace=True)
In [27]:
google.head(3)
Out[27]:
In [ ]:
In [ ]:
In [ ]: