I have two dataframes which have the same columns names but different values. Consider df1 with shape (5, 2) and df2 with shape (4,2). I want to plot a graph of the variable 'F1_S' vs 'ID' from df1 and df2 in the same graph. Note that variable 'ID' on the x-axis is categorical. I used the following to plot one of the dataframes.
names=list(df1['ID'])
values = list(df1['F1_S'])
fig, axs = plt.subplots(figsize=(20,20), sharey=True)
axs.scatter(names,values)
When I add the other dataframe to this, the shapes of the dfs causes an error.
Note that not all values of 'ID' in df1 will have corresponding 'F1_S' values in df2 and vice-versa.
EDIT:
Consider the two dataframes df1 and df2.
df1=pd.DataFrame({ 'ID': ['A1','A2','A6','A7','A9'], 'F1_S': [23,75,42,77,56] }, columns=['ID', 'F1_S'])
df2=pd.DataFrame({ 'ID': ['A3','A4','A5','A8'], 'F1_S': [66,43,56,86] }, columns=['ID', 'F1_S'])