Key Concepts

Review core concepts you need to learn to master this subject

Pandas DataFrame creation

# Ways of creating a Pandas DataFrame # Passing in a dictionary: data = {'name':['Anthony', 'Maria'], 'age':[30, 28]} df = pd.DataFrame(data) # Passing in a list of lists: data = [['Tom', 20], ['Jack', 30], ['Meera', 25]] df = pd.DataFrame(data, columns = ['Name', 'Age']) # Reading data from a csv file: df = pd.read_csv('students.csv')

The fundamental Pandas object is called a DataFrame. It is a 2-dimensional size-mutable, potentially heterogeneous, tabular data structure.

A DataFrame can be created multiple ways. It can be created by passing in a dictionary or a list of lists to the pd.DataFrame() method, or by reading data from a CSV file.

Date and Time in Python

# Ways of creating a Pandas DataFrame # Passing in a dictionary: data = {'name':['Anthony', 'Maria'], 'age':[30, 28]} df = pd.DataFrame(data) # Passing in a list of lists: data = [['Tom', 20], ['Jack', 30], ['Meera', 25]] df = pd.DataFrame(data, columns = ['Name', 'Age']) # Reading data from a csv file: df = pd.read_csv('students.csv')

Python provides a module named datetime to deal with dates and times.

It allows you to set date ,time or both date and time using the date(),time()and datetime() functions respectively, after importing the datetime module .

Importing Finance Data
Lesson 1 of 1
  1. 1
    Everyday trillions of bytes of financial data is sent over the internet. Whether it’s the price of a stock, an ecommerce transaction, or even information about the GDP of a country. All of this da…
  2. 2
    The easiest way to import financial data into Python is to get it from a file that is stored locally on your computer. date,open,close,volume 2013-02-08,54.38,54.66,9584224 2013-02-11,54.65,54.75…
  3. 3
    Many financial institutions, stock markets, and world banks provide large amounts of the data they store to the public. Most of this data is well organized, live updated, and accessible through th…
  4. 4
    The NASDAQ stock exchange identifies each of it’s stocks using a unique symbol: - Apple - APPL - Google - GOOGL - Tesla - TSLA It also provides a useful API for accessing the symbols t…
  5. 5
    Many of the APIs pandas-datareader connects with allow us to filter the data we get back by time. Financial institutions tend to keep track of data dating back several decades, and when we’re impo…
  6. 6
    Many finance APIs require us to pass along extra information when requesting data, one common argument is an API key. An API key is a unique string used to identify and authenticate entities reque…
  7. 7
    One of the risks of using public APIs is that you’re relying on an external service to work as expected at all times, and they often don’t. When an API is intermittently offline or not working we …
  8. 8
    Once we’ve imported a DataFrame full of finance data, there’s some pretty cool ways we can manipulate it. In this exercise we’ll look at the shift operation, a DataFrame function which shifts all…
  9. 9
    Two useful calculations that can be made on financial data are variance and covariance. To illustrate these concepts, let’s use the example of a DataFrame which measures stock and bond prices over…
  10. 10
    Congrats! You are now ready to import your own financial data for analysis! Before you move on, let’s take a minute to review what we’ve covered in this lesson. - Python is able to import financia…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo