Question
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started