Skip to content

Instantly share code, notes, and snippets.

@pcolazurdo
Created December 27, 2020 22:26
Show Gist options
  • Save pcolazurdo/463c81e704359b9741888b405bea8328 to your computer and use it in GitHub Desktop.
Save pcolazurdo/463c81e704359b9741888b405bea8328 to your computer and use it in GitHub Desktop.
Bug Report Pandas #38736
#as Reported in: https://github.com/pandas-dev/pandas/issues/38736
import pandas as pd
from pandas import Timestamp
import matplotlib.pyplot as plt
a= {'Argentina': {Timestamp('2020-11-17 00:00:00'): 56.0},
'Brazil': {Timestamp('2020-11-17 00:00:00'): 103.0},
'Guatemala': {Timestamp('2020-11-17 00:00:00'): 99.0},
'Ireland': {Timestamp('2020-11-17 00:00:00'): 53.0},
'Italy': {Timestamp('2020-11-17 00:00:00'): 19.0},
'Spain': {Timestamp('2020-11-17 00:00:00'): 49.0},
'Sweden': {Timestamp('2020-11-17 00:00:00'): 42.0},
'US': {Timestamp('2020-11-17 00:00:00'): 86.0},
'United Kingdom': {Timestamp('2020-11-17 00:00:00'): 32.0}}
b = {'Val': {'Afghanistan_confirmed': 50886},
'Country': {'Afghanistan_confirmed': 'Afghanistan'},
'Population': {'Afghanistan_confirmed': 37.171922},
'Ratio': {'Afghanistan_confirmed': 1368.9364784527418}}
doubling_df = pd.DataFrame().from_dict(a)
df = pd.DataFrame().from_dict(b)
_ = doubling_df.plot()
#plt.close('all') will solve the issue
_ = df.sort_values(by='Ratio', ascending=False)[:1]['Ratio'].plot.bar(color='blue')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment