This is my code:
import matplotlib.pyplot as plt
import pandas as pd
df1 = pd.DataFrame({
'ticker': ['a', 'c', 'd', 'e', 'f', 'h'],
'price': [1, 4, 5, 6, 8, 2]})
df2 = pd.DataFrame({
'ticker': ['a', 'b', 'c', 'd', 'e'],
'price': [1, 2, 4, 5, 6]})
df1.sort_values(by='price')
df2.sort_values(by='price')
plt.bar(df1['ticker'], df1['price'])
plt.bar(df2['ticker'], df2['price'])
the issue is that I'm not getting the right bar order:
the bar order should be a-b-h-c-d-e-f
.