Joining and Merging Dataframes – p.6 Data Analysis with Python and Pandas Tutorial




[ad_1]

Welcome to Part 6 of the Data Analysis with Python and Pandas tutorial series. In this part, we’re going to talk about joining and merging dataframes, as another method of combining dataframes. In the previous tutorial, we covered concatenation and appending.

Joining/merging tutorial text and sample code: http://pythonprogramming.net/join-merge-data-analysis-python-pandas-tutorial/

http://pythonprogramming.net
https://twitter.com/sentdex

Source


[ad_2]

Comment List

  • sentdex
    December 4, 2020

    Thank you! very helpful

  • sentdex
    December 4, 2020

    I have Q can read file.csv instead of value
    place halp me

  • sentdex
    December 4, 2020

    Poliyeeeeee

  • sentdex
    December 4, 2020

    Simple question, why you make a space after the comma?

  • sentdex
    December 4, 2020

    for merging sure if you have any sql experiecei it would be much simpler .. I advice u go through some sql guys.. any ways thank you man for such great tutorial ♥ take my heart =D

  • sentdex
    December 4, 2020

    need your help

  • sentdex
    December 4, 2020

    Thanks for the tutorial – however, this is where jupyter based dataframe visualisation would have been helpful to understand the nuances of various joins.

  • sentdex
    December 4, 2020

    Hello, Thank you so much for this video, it helped me a lot!!. However i have a doubt regarding "inplace = True", could you pls tell me the use of that?

  • sentdex
    December 4, 2020

    What if I want to add a new calculated column to my merged df based on a value from one or both dfs?

    So suppose I merge df1 and df2 on Year but I want my merged df to include a column ("Is HPI >x? Yes / No")

  • sentdex
    December 4, 2020

    Beautiful!!! Exactly what I needed. Thanks alot.

  • sentdex
    December 4, 2020

    I've been reading pandas documentation to find the difference between concat, merge and join. Your explanation is very clear, thanks! (I didn't understand the documentation entirely)

  • sentdex
    December 4, 2020

    Hey,
    What if I have two dataframes with different dtypes and I want to join them ? How can it be done ? As by simply using join() method all values are becoming NaN.

  • sentdex
    December 4, 2020

    Good work! I sorta understand it!

  • sentdex
    December 4, 2020

    Default for join is 'left ' not inner , at least in 2019

  • sentdex
    December 4, 2020

    How do you merge 2 dataframes with different id's (which is used with the 'on')

  • sentdex
    December 4, 2020

    Its great to know Merge on dataframes. In one of my requirement I tried merging 2 datasets from 2 different sources( sybase & Oracle) which has nearly 60k records each. While applying merge it throws memory exception. I'm using outer join to identify the records which are available in Sybase and not loaded in oracle. Would you be able to recommend something to fix this memory error?

  • sentdex
    December 4, 2020

    Hi Harrison, I religiously watch your tutorials. They're very detailed and works for all levels of understanding.
    I come from a SAS data engineering background. And for me SAS macros to write reusable code is very handy. I know there's ways to do that with python functions. But it would be great if you could do a tutorial to create user defined functions to work with dataframes in pandas.
    Thanks again.

  • sentdex
    December 4, 2020

    Thanks! 🙂

  • sentdex
    December 4, 2020

    aaaawwwweeeeeeessssssoooooooommmmmmmmmmmeeeeeeeee

  • sentdex
    December 4, 2020

    Could​ you please explain why the data replication occurs?

  • sentdex
    December 4, 2020

    Great videos! Thank you for the awesome course!

  • sentdex
    December 4, 2020

    I like your tutorials sentdex! But I have a problem, what is the cause of data replication?

    And what are the differences between join and merge

  • sentdex
    December 4, 2020

    Why does merge give a keyerror when we merge on index?

  • sentdex
    December 4, 2020

    Thank you @sentdex. These are high quality, crystal clear tutorials.

  • sentdex
    December 4, 2020

    Really helpful, thanks

  • sentdex
    December 4, 2020

    when using join , is join used for only inner join or it can be used for other tyes of join?

  • sentdex
    December 4, 2020

    Thank you so sooo much. You rock !!! –

  • sentdex
    December 4, 2020

    Fantastic. Was really chuffed you covered merging (joining) on an index – with all my data being time series (i.e. 'Date' as the index), this is exactly what I need!

    By the way, the plural of 'index' is 'indices' 😉

  • sentdex
    December 4, 2020

    Great as always, thanks sentdex!

  • sentdex
    December 4, 2020

    Hi Sentdex, thanks for the videos!
    I was wondering; as neither dataframe nor list objects have .encode as an attribute, how can I best .encode(utf-8) a dataframe containing non-ascii characters so that it displays properly?

  • sentdex
    December 4, 2020

    Why does it duplicate data when you merge the first time? 1:41

  • sentdex
    December 4, 2020

    "You sure can there little student!"

  • sentdex
    December 4, 2020

    Unfortunate confusion caused by the words join and merge. Because when you think of a sql join, in pandas that is a merge.

    From the docs:
    pandas provides a single function, merge, as the entry point for all standard database join operations between DataFrame objects:

    join just appears to be a special case of merge:
    The related DataFrame.join method, uses merge internally for the index-on-index (by default) and column(s)-on-index join. If you are joining on index only, you may wish to use DataFrame.join to save yourself some typing.

  • sentdex
    December 4, 2020

    Why is there even a duplication taking place? Basically, i am not able to understand merging based on 2 keys. Any help would be appreciated. I'm a newbie.

  • sentdex
    December 4, 2020

    You keep asking what's going on? …. but you never listen to what I have to say 🙁
    JK, amazing tutorial & fabulous approach.

Write a comment