Joining twodata frames by the axes

0

I am 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 company that rents bikes and other weather information for the day.

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

Could you help me?

    
asked by anonymous 24.04.2018 / 02:05

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 I use "left_on" and "right_on", eg:

import pandas as pd

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

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

Reference: link

    
24.04.2018 / 03:13