Page Visists Funnel Project: different len of initial and merged DataFrames

Hello, everyone!

Doing “Page Visists Funnel Project” I have met a strange thing: the length of left-merged DF is longer than initial DF.

For example:

mergedDF = pd.merge(visits, cart, how="left")

print(len(mergedDF))
print(len(visits)

This code gives me the following answers:
2052
2000

How can it be that the number of rows in the merged DF (2052) is bigger than in the initial one (2000)?

Thank you in advance for your help :slight_smile:

Hi @nastasia7,

Here is a link to the project, so that other users can find it: Page Visits Funnel.

With the left merge, all of the rows in the visits DF are included in mergedDF, so that accounts for 2000 of the rows. There are 52 rows in the cart DF wherein the user_id is a repeat of one that has been encountered previously in that DF, and each of those rows is included as an additional one in mergedDF, giving us a total of 2052 rows.

1 Like

Hi Glen!

Thanks a lot for your explanation and link:). Now it is clear

1 Like