How to Replace Values of Dataframes | Replace, Where, Mask, Update and More

Sdílet
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

Komentáře • 62

  • @misraturp
    @misraturp  Před rokem

    👉 All you need to know about Pandas in one place!
    Download my Pandas Cheat Sheet (free)
    misraturp.gumroad.com/l/pandascs

  • @himanshupandey9902
    @himanshupandey9902 Před 2 lety +2

    Hey, again. You really make things simpler, so that a laymen also can understand.

  • @message59
    @message59 Před 7 měsíci +1

    hands down your videos are the best ressources I found to these kind of topics
    thanks a lot for making these videos✌🏻😁

  • @maxinechantel8361
    @maxinechantel8361 Před 2 lety +4

    Hi Misra, thank you for your videos they are helping me to learn Pandas. You explain so simple and it is really encouraging.

    • @misraturp
      @misraturp  Před 2 lety +1

      That's amazing to hear, thank you Maxine!

  • @saheedoyewole9424
    @saheedoyewole9424 Před rokem +1

    Thanks a lot Misra, you're doing a wonderful job.

  • @lucifer-kq1sc
    @lucifer-kq1sc Před rokem +2

    you're making my life easier with these tuts :')

  • @burakceylan.92
    @burakceylan.92 Před 2 lety

    Crystal clear speak and to the point infos. Thank you

  • @avonstar8893
    @avonstar8893 Před rokem

    Very helpful Misra. Thank you.

  • @chastippett
    @chastippett Před rokem

    super helpful. have never seen the pd.cut function - Thank you

  • @birsenbas1009
    @birsenbas1009 Před rokem

    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!

    • @misraturp
      @misraturp  Před rokem

      That's great to hear Birsen! Happy to hear you like the videos and that they motivate you.

  • @ArnauViaM
    @ArnauViaM Před rokem +1

    pandas cut seems extremely useful! Thanks

  • @Asma-ir8rr
    @Asma-ir8rr Před 6 měsíci

    I like your explanation 👌🏻♥️

  • @isha4350
    @isha4350 Před 2 měsíci

    Informative video .

  • @reledata8035
    @reledata8035 Před rokem

    thank you Misra

  • @kennethstephani692
    @kennethstephani692 Před rokem

    Terrific Video!!

  • @mehdismaeili3743
    @mehdismaeili3743 Před 2 lety

    Excellent, thanks.

  • @GregThatcher
    @GregThatcher Před 2 měsíci

    Thanks!

  • @graceblomqvist5378
    @graceblomqvist5378 Před rokem

    Very very good! thx!

  • @curtisjackson3377
    @curtisjackson3377 Před 2 lety +2

    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
    🍻

    • @Kidpambi
      @Kidpambi Před 2 lety

      This would be very helpful 🎉

    • @misraturp
      @misraturp  Před 2 lety

      Hey Curtis, you're very welcome. :) I actually have that video already: czcams.com/video/788KHREDbX8/video.html

  • @mjacfardk
    @mjacfardk Před 2 lety

    Thank you
    Pls video of pd.cut and filling/imputing missing values

    • @misraturp
      @misraturp  Před 2 lety

      Yes, working on that one now! Thank you for the suggestion!

  • @durgav8122
    @durgav8122 Před 9 měsíci

    Hai Mam....Can you please come with the videos for SQL in data Analytics.....?

  • @e.t.499
    @e.t.499 Před 2 lety +2

    Hey Misra, can you make a video about deciding under which conditions we should use normalization or standardization?

  • @vrbaac1641
    @vrbaac1641 Před rokem

    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 ^^

    • @misraturp
      @misraturp  Před rokem +1

      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 :)

  • @learnwithgandalf
    @learnwithgandalf Před 2 lety +1

    cool mam

  • @muriloambrozio7563
    @muriloambrozio7563 Před 7 měsíci

    Could I use a list in the loc. Method?

  • @vashisht1
    @vashisht1 Před 3 měsíci

    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 ..

  • @user-ru5yt4vg4v
    @user-ru5yt4vg4v Před 4 měsíci

    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?

  • @barisbulut7193
    @barisbulut7193 Před rokem

    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

  • @sakhachowdhury5266
    @sakhachowdhury5266 Před měsícem

    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.

  • @SlimPit
    @SlimPit Před rokem

    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.

  • @marcelocarvalho4510
    @marcelocarvalho4510 Před rokem

    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.

  • @tonywillingham8109
    @tonywillingham8109 Před rokem

    How does one download the chest sheet? It is unclear.

    • @misraturp
      @misraturp  Před rokem

      Here is the link: misraturp.gumroad.com/l/pandascs

  • @arvinstatistics
    @arvinstatistics Před měsícem

    You are so pretty and smart.

  • @Krishnapatil1996
    @Krishnapatil1996 Před rokem

    as compared to data cleansing .... till the end video, I just see you ...

  • @myselfandpesit
    @myselfandpesit Před rokem

    Too many ways to do it makes it quite confusing for me

  • @user-ss9je8hf8j
    @user-ss9je8hf8j Před 10 měsíci

    aww

  • @comment8767
    @comment8767 Před 2 měsíci +1

    Misra is too distracting .... makes it difficult to concentrate on the code...

  • @barspinoza
    @barspinoza Před rokem

    Thanks!