Importing flat files using pandas

Introduction to Importing Data in Python

Hugo Bowne-Anderson

Data Scientist at DataCamp

What a data scientist needs

  • Two-dimensional labeled data structure(s)
  • Columns of potentially different types
  • Manipulate, slice, reshape, groupby, join, merge
  • Perform statistics
  • Work with time series data
Introduction to Importing Data in Python

Pandas and the DataFrame

ch_1_4.009.png

Introduction to Importing Data in Python

Pandas and the DataFrame

ch_1_4.010.png

Introduction to Importing Data in Python

Pandas and the DataFrame

ch_1_4.012.png

  • DataFrame = pythonic analog of R's data frame
Introduction to Importing Data in Python

Pandas and the DataFrame

ch_1_4.015.png

Introduction to Importing Data in Python

Manipulating pandas DataFrames

  • Exploratory data analysis
  • Data wrangling
  • Data preprocessing
  • Building models
  • Visualization
  • Standard and best practice to use pandas
Introduction to Importing Data in Python

Importing using pandas

import pandas as pd

filename = 'winequality-red.csv' data = pd.read_csv(filename)
data.head()
   volatile acidity  citric acid  residual sugar
0              0.70         0.00             1.9
1              0.88         0.00             2.6
2              0.76         0.04             2.3
3              0.28         0.56             1.9
4              0.70         0.00             1.9
data_array = data.to_numpy()
Introduction to Importing Data in Python

You'll experience:

  • Importing flat files in a straightforward manner
  • Importing flat files with issues such as comments and missing values
Introduction to Importing Data in Python

Let's practice!

Introduction to Importing Data in Python

Preparing Video For Download...