Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python function to clean a csv dataframe I would like to know how we can make an automatic function where as soon as we enter

Python function to clean a csv dataframe

I would like to know how we can make an automatic function where as soon as we enter the name of the column of the dataframe, it keeps only the numbers inside.

The function can be in a file . py, which I can transport and use directly in a file . ipynb

For example:

- There is a column price with have: "UK $887.00" or "US $999,000.99/kj" or "EUR 55,009.57/ea55,009.57/ea55,009.57/ea"

How a function can only keep the right price, without the comma. And if possible keep the currency in another column with only "UK", "US", etc...

- Or a column number of like : "1 like", or "54 like54like"

In this case, only keep the right number of like.

And this function can be used directly with other csv column

image text in transcribed

price Like us $289.00 297like us $269.00 379like us $269.00/ea 431 like us $350.00 us $143.91 11 like 11 lik au $800.00 us $111.36 Olikeblike us $1,899.95us 5 like like

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

Write a NumPy program to find the most frequent value in an array

Answered: 1 week ago

Question

Explain Coulomb's law with an example

Answered: 1 week ago

Question

What is operating system?

Answered: 1 week ago

Question

What is Ohm's law and also tell about Snell's law?

Answered: 1 week ago