How to Replace Values of Dataframes | Replace, Where, Mask, Update and More
Vložit
- čas přidán 20. 07. 2024
- While cleaning up outliers, filling in missing values, or just doing some data maintenance we need to update the values in our Pandas dataframe. Sometimes you select a subset of the original dataframe, and sometimes it needs to be pinpointed with an index value. So in this video, I show you every way I know how to replace and/or modify values in your pandas dataframes.
Get the code here: github.com/misraturp/Pandas-d...
Find missing values in data with Pandas | Beginner tutorial - • Find missing values in...
Pandas functions: Apply vs. Map vs. Applymap - • Pandas Functions: Appl...
00:00 Introduction
00:29 "fillna"
01:46 "replace"
03:09 "loc" and "at"
05:59 "np.where"
07:25 "mask"
08:30 "cut"
09:35 "update"
10:32 apply, map and applymap
10:54 Grab your Pandas Cheat Sheet!
👋 Keep in touch?
==========================
🐥 Twitter - / misraturp
🔗 LinkedIn - / misraturp
📹 CZcams - / @misraturp
🌎 Website - misraturp.com/
Courses & resources
============================
📙 Fundamentals of Deep Learning in 25 pages
misraturp.gumroad.com/l/fdl
👩💻 Hands-on Data Science: Complete your first portfolio project
www.misraturp.com/hods
📥 Streamlit template
misraturp.gumroad.com/l/stemp
🤖 Deep Learning 101 with Python and Keras (FREE)
• 50 Days of Deep Learning
🏃♀️ Data Science Kick-starter mini-course (FREE)
misraturp.gumroad.com/l/kick-...
🐼 Pandas cheat sheet (FREE)
misraturp.gumroad.com/l/pandascs
📝 NNs hyperparameters cheat sheet (FREE)
misraturp.gumroad.com/l/hcs - Věda a technologie
👉 All you need to know about Pandas in one place!
Download my Pandas Cheat Sheet (free)
misraturp.gumroad.com/l/pandascs
Hey, again. You really make things simpler, so that a laymen also can understand.
Amazing to hear!
hands down your videos are the best ressources I found to these kind of topics
thanks a lot for making these videos✌🏻😁
Hi Misra, thank you for your videos they are helping me to learn Pandas. You explain so simple and it is really encouraging.
That's amazing to hear, thank you Maxine!
Thanks a lot Misra, you're doing a wonderful job.
Thank you!
you're making my life easier with these tuts :')
even easier!?
Crystal clear speak and to the point infos. Thank you
You're very welcome!
Very helpful Misra. Thank you.
Great to hear :)
super helpful. have never seen the pd.cut function - Thank you
You're very welcome!
Hi Mısra, you're really have great explanations. I have learned a lot of and useful things even a few days. I am really excited to continue listening your videos aas a new data scientist candidate. Also you make me very motivated. Thanks a lot again!
That's great to hear Birsen! Happy to hear you like the videos and that they motivate you.
pandas cut seems extremely useful! Thanks
I know right! You're welcome.
I like your explanation 👌🏻♥️
Informative video .
thank you Misra
Terrific Video!!
Thank you!
Excellent, thanks.
You're welcome!
Thanks!
Very very good! thx!
Glad you like it!
Hey MIsra, thanks for another simple to understand video. Can you possibly make a similar thread on pandas dataframe Join/Merge? That would be great help. Thanks again.
Cheers
🍻
This would be very helpful 🎉
Hey Curtis, you're very welcome. :) I actually have that video already: czcams.com/video/788KHREDbX8/video.html
Thank you
Pls video of pd.cut and filling/imputing missing values
Yes, working on that one now! Thank you for the suggestion!
Hai Mam....Can you please come with the videos for SQL in data Analytics.....?
Hey Misra, can you make a video about deciding under which conditions we should use normalization or standardization?
Great suggestion!
take that as a no
Hi, Thank you for this video... it is very clear and easy to follow... I also want to ask... In case of a data frame having negative numbers, is it possible to replace these negative numbers by its corresponding absolute value, using the same routine in the video? thank you ^^
I don't know this off the top of my head but I'm sure there is a quick way to achieve this using Pandas :)
cool mam
Could I use a list in the loc. Method?
When didn't you use replace like this
data[ 'Agency'].replace( { dict})
Inside dictionary I will give all the old values as key and new values a pair ..
Hi Misra,
If we have a column where we are having a message which is returned from the device, so from this message how can we create a new column by taking keyword from the existing column and display the status of it in the new column by using python?
selam, thanks for the info. i have a probem in changing characters within the cells. in my dataframe, some of values are for instance: 12.4 and some of them are 12,4, meaning some are seperated with comma, and some are seperated with dot. how can i change all the dots with commas without changing the values. thanks
watch the vid
Can we use any function to replace a data.like normally we replace a data with tha mean of that column.is there any other method instead of mean.
Hi, i have a question that i dont know. I need to change a specific value in a specific line in my Dataframe. Example in your Dataframe in Column "Job ID" in the line (1), i want to change the value 379094 to another value, how can i do this? I tried to loc but not worked. Can someone help please, thank you. Sorry for the english, im brazilian.
watch the vid
Hello, I loved your video!
I would like to ask a question. In this case, the intent would be data cleaning where I have a dataframe where all the information in the "data" column has characters that shouldn't be there, for example: '01012023TT00'. I would like to remove these "TT00" characters. How should I do?
I'm doing it this way, but it doesn't update the dataframe.:
import pandas as pd
import numpy as np
df = pd.read_csv('/content/HRDataset_v14.csv')
df.head()
df['Employee_Name'].str.replace('Anderson, Carol','Anderson')
df
################
If we put the df = df['Employee_Name'].str.replace('Anderson, Carol','Anderson')
It will update, but not in the dataframe.
watch the vid
How does one download the chest sheet? It is unclear.
Here is the link: misraturp.gumroad.com/l/pandascs
You are so pretty and smart.
as compared to data cleansing .... till the end video, I just see you ...
Too many ways to do it makes it quite confusing for me
themore thebetter
aww
Misra is too distracting .... makes it difficult to concentrate on the code...
Thanks!
You're very welcome!