Joining two frames by axes

Asked

Viewed 407 times

0

I’m a beginner in the study of programming and I have a question:

I need to merge two dataframes into the date column. A data frame shows information about a bike rental company and other weather information of the day.

The DF of the company has much more line and the same date repeats several times, in the other is a line for each date.

Could you help me

1 answer

1

Opa...

i use pd.merge, if the columns in the two dataframes are the same I use "on".

import pandas as pd

pd.merge(df_1,df_2,on='data')

if the names are different use "left_on" and "right_on", ex:

import pandas as pd

pd.merge(df_1,df_2,left_on='data',right_on='data')

left_on for the left and right_on dataframe column for the right dataframe column.

Reference: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.merge.html

Browser other questions tagged

You are not signed in. Login or sign up in order to post.