Search this site
Embedded Files
AIMD GPDS Courses
  • Home
  • Courses
  • Contact
AIMD GPDS Courses
  • Home
  • Courses
  • Contact
  • More
    • Home
    • Courses
    • Contact

日本語  ❯

Lesson 4    ❮    Lesson List    ❮    Top Page

4.1 Functions    

4.2 Lambda Functions    

4.3 Handling Exceptions    

4.4 Intro to RegEx    

❯  4.5  RegEx for Data Cleaning

⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺
EXPECTED COMPLETION TIME
❲▹❳  Video   12m 28s
☷  Interactive readings   5m
✑  Practice 4.5 (G Colab)   25m

Replacing a Patterns

In data cleaning, some corrupted characters can be deleted or replaced.

re.sub(pattern, sub, string)
replaces all the pattern in string with sub.

Using List Comprehension for Data Cleaning

Cleaning a part of data using list comprehension can be useful.

We used all that we have learned previously in this example.

Using Functions for Data Cleaning

Function is handy since it can be used repeatedly for multiple data set.

strip() clean unnecessary whitespaces at the start and end of a string.

©2023. All rights reserved.  Samy Baladram,
Graduate Program in Data Science - GSIS - Tohoku University
Google Sites
Report abuse
Page details
Page updated
Google Sites
Report abuse