diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 804abc7..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -custom: ['https://www.dunderdata.com'] diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index c7b9677..0000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -1,45 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python package - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.6, 3.7, 3.8] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Download ffmpeg linux - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - sudo apt-get update - sudo apt-get install ffmpeg - sudo apt install ffmpeg - - name: Download ffmpeg mac - if: ${{ matrix.os == 'macos-latest' }} - run: brew install ffmpeg - - name: Download ffmpeg windows - if: ${{ matrix.os == 'windows-latest' }} - run: choco install ffmpeg --no-progress - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest matplotlib==3.2 pandas plotly - - name: Test with pytest - run: | - pytest diff --git a/.gitignore b/.gitignore index 35e7bb9..052974d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ site/ *.mp4 docs/ data/ +.idea/ +venv/ \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index d0add7e..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include LICENSE bar_chart_race/_codes/* \ No newline at end of file diff --git a/README.md b/README.md index aa7f00b..148360f 100644 --- a/README.md +++ b/README.md @@ -1,117 +1,126 @@ # Bar Chart Race -[![](https://img.shields.io/pypi/v/bar_chart_race)](https://pypi.org/project/bar_chart_race) -[![PyPI - License](https://img.shields.io/pypi/l/bar_chart_race)](LICENSE) - Make animated bar and line chart races in Python with matplotlib or plotly. -![img](https://github.com/dexplo/bar_chart_race/raw/gh-pages/images/covid19_horiz.gif) - -## Official Documentation - -Visit the [bar_chart_race official documentation](https://www.dexplo.org/bar_chart_race) for detailed usage instructions. - -## Installation - -Install with either: +Original Repo (without icons) : [https://github.com/dexplo/bar_chart_race](https://github.com/dexplo/bar_chart_race) -* `pip install bar_chart_race` -* `conda install -c conda-forge bar_chart_race` +Andres Berejnoi's Repo (with +icons) : [https://github.com/andresberejnoi/bar_chart_race](https://github.com/andresberejnoi/bar_chart_race) -## Quickstart +--- -Must begin with a pandas DataFrame containing 'wide' data where: +## Top Computer Science Schools 2000 - 2020 -* Every row represents a single period of time -* Each column holds the value for a particular category -* The index contains the time component (optional) - -The data below is an example of properly formatted data. It shows total deaths from COVID-19 for several countries by date. +![img](demo.gif) -![img](https://github.com/dexplo/bar_chart_race/raw/gh-pages/images/wide_data.png) +--- -### Create bar and line chart races +## Installation -There are three core functions available to construct the animations. +First Create a New Virtual Environment & Activate It: -* `bar_chart_race` -* `bar_chart_race_plotly` -* `line_chart_race` +``` +pip install virtualenv +virtualenv venv +.\venv\Scripts\activate +``` -The above animation was created with the help of matplotlib using the following call to `bar_chart_race`. +Install `bar_chart_race` using `pip`: -```python -import bar_chart_race as bcr -df = bcr.load_dataset('covid19_tutorial') -bcr.bar_chart_race( - df=df, - filename='../docs/images/covid19_horiz.gif', - orientation='h', - sort='desc', - n_bars=8, - fixed_order=False, - fixed_max=True, - steps_per_period=20, - period_length=500, - end_period_pause=0, - interpolate_period=False, - period_label={'x': .98, 'y': .3, 'ha': 'right', 'va': 'center'}, - period_template='%B %d, %Y', - period_summary_func=lambda v, r: {'x': .98, 'y': .2, - 's': f'Total deaths: {v.sum():,.0f}', - 'ha': 'right', 'size': 11}, - perpendicular_bar_func='median', - colors='dark12', - title='COVID-19 Deaths by Country', - bar_size=.95, - bar_textposition='inside', - bar_texttemplate='{x:,.0f}', - bar_label_font=7, - tick_label_font=7, - tick_template='{x:,.0f}', - shared_fontdict=None, - scale='linear', - fig=None, - writer=None, - bar_kwargs={'alpha': .7}, - fig_kwargs={'figsize': (6, 3.5), 'dpi': 144}, - filter_column_colors=False) +``` +pip install git+https://github.com/programiz/bar_chart_race.git@master ``` -### Save animation to disk or embed into a Jupyter Notebook +You also need to install +FFmpeg: [https://github.com/BtbN/FFmpeg-Builds/releases/](https://github.com/BtbN/FFmpeg-Builds/releases/) -If you are working within a Jupyter Notebook, leave the `filename` as `None` and it will be automatically embedded into a Jupyter Notebook. +--- -```python -bcr.bar_chart_race(df=df, filename=None) -``` +## Usage -![img](https://github.com/dexplo/bar_chart_race/raw/gh-pages/images/bcr_notebook.png) +Create a file and use the `bar_chart_race` library as shown below: -### Customization +```python +import bar_chart_race as bcr +import pandas as pd -There are many options to customize the bar chart race to get the animation you desire. Below, we have an animation where the maximum x-value and order of the bars are set for the entire duration. A custom summary label and perpendicular bar of the median is also added. +df = pd.read_csv("data.csv", index_col="Date") -```python -def period_summary(values, ranks): - top2 = values.nlargest(2) - leader = top2.index[0] - lead = top2.iloc[0] - top2.iloc[1] - s = f'{leader} by {lead:.0f}' - return {'s': s, 'x': .99, 'y': .03, 'ha': 'right', 'size': 8} - -df_baseball = bcr.load_dataset('baseball').pivot(index='year', - columns='name', - values='hr') -df_baseball.bcr.bar_chart_race( - period_length=1000, - fixed_max=True, - fixed_order=True, - n_bars=10, - period_summary_func=period_summary, - period_label={'x': .99, 'y': .1}, - period_template='Season {x:,.0f}', - title='Top 10 Home Run Hitters by Season Played') -``` +# replace empty values with 0 +df.fillna(0.0, inplace=True) -![img](https://github.com/dexplo/bar_chart_race/raw/gh-pages/images/baseball_horiz.gif) +# using the bar_chart_race package +bcr.bar_chart_race( + # must be a DataFrame where each row represents a single period of time. + df=df, + + # name of the video file + filename="video.mp4", + + # specify location of image folder + img_label_folder="bar_image_labels", + + # change the Figure properties + fig_kwargs={ + 'figsize': (26, 15), + 'dpi': 120, + 'facecolor': '#F8FAFF' + }, + + # orientation of the bar: h or v + orientation="h", + + # sort the bar for each period + sort="desc", + + # number of bars to display in each frame + n_bars=10, + + # to fix the maximum value of the axis + # fixed_max=True, + + # smoothness of the animation + steps_per_period=45, + + # time period in ms for each row + period_length=1500, + + # custom set of colors + colors=[ + '#6ECBCE', '#FF2243', '#FFC33D', '#CE9673', '#FFA0FF', '#6501E5', '#F79522', '#699AF8', '#34718E', '#00DBCD', + '#00A3FF', '#F8A737', '#56BD5B', '#D40CE5', '#6936F9', '#FF317B', '#0000F3', '#FFA0A0', '#31FF83', '#0556F3' + ], + + # title and its styles + title={'label': 'Programming Language Popularity 1990 - 2020', + 'size': 52, + 'weight': 'bold', + 'pad': 40 + }, + + # adjust the position and style of the period label + period_label={'x': .95, 'y': .15, + 'ha': 'right', + 'va': 'center', + 'size': 72, + 'weight': 'semibold' + }, + + # style the bar label text + bar_label_font={'size': 27}, + + # style the labels in x and y axis + tick_label_font={'size': 27}, + + # adjust the style of bar + # alpha is opacity of bar + # ls - width of edge + bar_kwargs={'alpha': .99, 'lw': 0}, + + # adjust the bar label format + bar_texttemplate='{x:.2f}', + + # adjust the period label format + period_template='{x:.0f}', +) +``` \ No newline at end of file diff --git a/bar_chart_race/_bar_chart_race.py b/bar_chart_race/_bar_chart_race.py index 8b31d34..41a50dd 100644 --- a/bar_chart_race/_bar_chart_race.py +++ b/bar_chart_race/_bar_chart_race.py @@ -7,9 +7,44 @@ from ._func_animation import FuncAnimation from matplotlib.colors import Colormap +from matplotlib.offsetbox import OffsetImage,AnnotationBbox,TextArea +from PIL import Image #for opening images +#import matplotlib.image as mpimg +import os + from ._common_chart import CommonChart from ._utils import prepare_wide_data + + +def get_image_label(root_folder,name): + #path = "data/flags/Flags/flags/flags/24/{}.png".format(name.title()) + path = os.path.join(root_folder , name) + #im = plt.imread(path) + img = Image.open(path) + img.thumbnail((200,200),Image.ANTIALIAS) + return img + +def get_image_name(col_name): + ''' + Needs to account for more cases. This is incomplete but it will do for now. It assumes there + is only one `.` in the filename. If it finds a dot, it will assume the name already has an extension. + If not, it will append `.png` to the name. + col_name: str + Takes a column or bar name and attaches an image extension (only .png for now) + + Returns + ---------- + str + ''' + split_name = col_name.split('.') + if len(split_name) > 1: + img_name = split_name + else: + img_name = col_name + '.png' + return img_name + + class _BarChartRace(CommonChart): def __init__(self, df, filename, orientation, sort, n_bars, fixed_order, fixed_max, @@ -17,7 +52,8 @@ def __init__(self, df, filename, orientation, sort, n_bars, fixed_order, fixed_m period_label, period_template, period_summary_func, perpendicular_bar_func, colors, title, bar_size, bar_textposition, bar_texttemplate, bar_label_font, tick_label_font, tick_template, shared_fontdict, scale, fig, writer, - bar_kwargs, fig_kwargs, filter_column_colors): + bar_kwargs, fig_kwargs, filter_column_colors, + img_label_folder,tick_label_mode,tick_image_mode): self.filename = filename self.extension = self.get_extension() self.orientation = orientation @@ -45,7 +81,7 @@ def __init__(self, df, filename, orientation, sort, n_bars, fixed_order, fixed_m self.fps = 1000 / self.period_length * steps_per_period self.writer = self.get_writer(writer) self.filter_column_colors = filter_column_colors - self.extra_pixels = 0 + self.extra_pixels = 2 self.validate_params() self.bar_kwargs = self.get_bar_kwargs(bar_kwargs) @@ -58,6 +94,12 @@ def __init__(self, df, filename, orientation, sort, n_bars, fixed_order, fixed_m self.subplots_adjust = self.get_subplots_adjust() self.fig = self.get_fig(fig) + self.img_label_folder = img_label_folder #root folder where image labels are stored + self.tick_label_mode = tick_label_mode + self.tick_image_mode = tick_image_mode + self.img_label_artist = [] #stores image artists + + def validate_params(self): if isinstance(self.filename, str): if '.' not in self.filename: @@ -142,6 +184,108 @@ def get_font(self, font, ticks=False): font = {**default_font_dict, **font} return font + def offset_image(self,location,lenght,name,ax): + """ + Creates AnnotationBbox objects to display image labels on the graph. There is a + new AnnotationBbox object created at each frame. Maybe a better approach is to create + the original AnnotationBbox objects and then simply update them as the program runs. + + Parameters + ---------- + location: scalar or array + Coordinate of the bar (in the axis that is moving) + name: str + Filename of image file stored in `self.img_label_folder` + + """ + #load image as an OffsetImage object + img_name = get_image_name(name) + img = get_image_label(self.img_label_folder,img_name) + im = OffsetImage(img,zoom=.8) # change zoom value based on icon image's size + im.image.axes = ax + + + if self.orientation=='h': + ab = AnnotationBbox(im,(lenght,location,),xybox=(0,0.),frameon=False,xycoords='data', + boxcoords='offset points',pad=0) + if self.tick_label_mode=='mixed': + #load text as TextArea object + label_text = TextArea(name) + text_ab = AnnotationBbox(label_text,(0,location,),xybox=(-30,-5),frameon=False,xycoords='data', + boxcoords='offset points',pad=0) + self.img_label_artist.append(text_ab) + ax.add_artist(text_ab) + + elif self.orientation=='v': + ab = AnnotationBbox(im,(location,lenght,),xybox=(0.,0),frameon=False,xycoords='data', + boxcoords='offset points',pad=0) + if self.tick_label_mode=='mixed': + #load text as TextArea object + label_text = TextArea(name) + text_ab = AnnotationBbox(label_text,(location,0,),xybox=(-5,30),frameon=False,xycoords='data', + boxcoords='offset points',pad=0) + self.img_label_artist.append(text_ab) + ax.add_artist(text_ab) + + self.img_label_artist.append(ab) + ax.add_artist(ab) + + def _add_tick_label_offset_image(self,location,length,name,ax): + """ + Creates AnnotationBbox objects to display image labels on the graph. There is a + new AnnotationBbox object created at each frame. Maybe a better approach is to create + the original AnnotationBbox objects and then simply update them as the program runs. + + Parameters + ---------- + location: scalar or array + Coordinate of the bar (in the axis that is moving) + name: str + Filename of image file stored in `self.img_label_folder` + + """ + #load image as an OffsetImage object + img_name = get_image_name(name) + img = get_image_label(self.img_label_folder,img_name) + im = OffsetImage(img,zoom=.25) # change zoom value based on icon image's size + im.image.axes = ax + + #renderer = self.fig.canvas.renderer + #_,_,img_width,img_height = im.get_window_extent(renderer=None) + #print(im.get_data()) + # img_width = 30 + # img_height = 30 + + if self.tick_image_mode=='trailing': #images move along with the bar + if self.orientation=='h': + #len_bar = (img_width/2) + 2 if length < img_width else length - (img_width/2) - 2 + len_bar = length + # xybox_val = (-38,0) if length < 30 else (-38,0) + xybox_val = (38,0) + ab = AnnotationBbox(im,(len_bar,location,),xybox=xybox_val,frameon=False,xycoords='data', + boxcoords='offset points',pad=0) + else: + #len_bar = (img_height/2) + 2 if length < img_height else length - (img_height/2) - 2 + len_bar = length + xybox_val = (0,15) if length < 30 else (0,-5) + ab = AnnotationBbox(im,(location,len_bar,),xybox=(0.,-10.),frameon=False,xycoords='data', + boxcoords='offset points',pad=0) + + elif self.tick_image_mode=='fixed': #images stay fixed at the beginning of the bar + if self.orientation=='h': + #len_bar = (img_width/2) + 2 + len_bar = 10 + ab = AnnotationBbox(im,(len_bar,location,),xybox=(10,0.),frameon=False,xycoords='data', + boxcoords='offset points',pad=0) + else: + #len_bar = (img_height/2) + 2 + len_bar = 10 + ab = AnnotationBbox(im,(location,len_bar,),xybox=(0.,10.),frameon=False,xycoords='data', + boxcoords='offset points',pad=0) + + self.img_label_artist.append(ab) + ax.add_artist(ab) + def prepare_data(self, df): if self.fixed_order is True: last_values = df.iloc[-1].sort_values(ascending=False) @@ -242,18 +386,26 @@ def get_max_plotted_value(self): def prepare_axes(self, ax): value_axis = ax.xaxis if self.orientation == 'h' else ax.yaxis - value_axis.grid(True, color='white') + # value_axis.grid(True, color='white') if self.tick_template: value_axis.set_major_formatter(self.tick_template) - ax.tick_params(labelsize=self.tick_label_font['size'], length=0, pad=2) + + + ax.grid(True, axis='x', color='#D3DCE6', linewidth=5, zorder=0) + + # ax.tick_params(labelsize=self.tick_label_font['size'], length=0, pad=2) + ax.tick_params(axis='x', length=12, labelsize=self.tick_label_font['size'], pad=1, color='#F8FAFF') + ax.tick_params(axis='y', length=12, labelsize=self.tick_label_font['size'], pad=1, color='#ffffff00') + ax.set_facecolor('#F8FAFF') + ax.minorticks_off() ax.set_axisbelow(True) - ax.set_facecolor('.9') + ax.set_title(**self.title) # min_val = 1 if self.scale == 'log' else 0 for spine in ax.spines.values(): - spine.set_visible(False) + spine.set_visible(True) limit = (.2, self.n_bars + .8) if self.orientation == 'h': @@ -264,9 +416,15 @@ def prepare_axes(self, ax): ax.set_yscale(self.scale) ax.tick_params(axis='x', labelrotation=30) + ax.spines['left'].set_linewidth(5) + ax.spines['left'].set_color('#D3DCE6') + ax.spines['right'].set_linewidth(0) + ax.spines['top'].set_linewidth(0) + ax.spines['bottom'].set_linewidth(0) + def get_subplots_adjust(self): import io - fig = plt.Figure(**self.fig_kwargs) + fig = plt.Figure(**self.fig_kwargs, tight_layout=False) ax = fig.add_subplot() plot_func = ax.barh if self.orientation == 'h' else ax.bar bar_location, bar_length, cols, _ = self.get_bar_info(-1) @@ -323,10 +481,11 @@ def fix_axis_limits(self, ax): ax.set_ylim(None, self.fixed_max_value) def create_figure(self): - fig = plt.Figure(**self.fig_kwargs) + fig = plt.Figure(**self.fig_kwargs, tight_layout=False) + ax = fig.add_subplot() - left, bottom = self.subplots_adjust - fig.subplots_adjust(left=left, bottom=bottom) + # left, bottom = self.subplots_adjust + # fig.subplots_adjust(left=left, bottom=bottom) self.prepare_axes(ax) self.fix_axis_limits(ax) return fig @@ -350,12 +509,14 @@ def plot_bars(self, ax, i): if self.orientation == 'h': ax.barh(bar_location, bar_length, tick_label=cols, color=colors, **self.bar_kwargs) - ax.set_yticklabels(ax.get_yticklabels(), **self.tick_label_font) + ax.set_yticklabels(ax.get_yticklabels(), **self.tick_label_font,wrap=True)#,visible=False) + #ax.set_yticklabels([]) + #ax.tick_params(top=False, bottom=False, left=False, right=False, labelleft=True, labelbottom=True) if not self.fixed_max and self.bar_textposition == 'outside': max_bar = bar_length.max() new_max_pixels = ax.transData.transform((max_bar, 0))[0] + self.extra_pixels new_xmax = ax.transData.inverted().transform((new_max_pixels, 0))[0] - ax.set_xlim(ax.get_xlim()[0], new_xmax) + ax.set_xlim(ax.get_xlim()[0] , new_xmax) else: ax.bar(bar_location, bar_length, tick_label=cols, color=colors, **self.bar_kwargs) @@ -366,6 +527,12 @@ def plot_bars(self, ax, i): new_ymax = ax.transData.inverted().transform((0, new_max_pixels))[1] ax.set_ylim(ax.get_ylim()[0], new_ymax) + if self.img_label_folder: #here I am handling the addition of images as the bar tick labels + zipped = zip(bar_location,bar_length,cols) + for bar_loc,bar_len,col_name in zipped: + #self.offset_image(bar_loc,bar_len,col_name,ax) + self._add_tick_label_offset_image(bar_loc,bar_len,col_name,ax) + self.set_major_formatter(ax) self.add_period_label(ax, i) self.add_period_summary(ax, i) @@ -407,7 +574,7 @@ def add_bar_labels(self, ax, bar_location, bar_length): else: zipped = zip(bar_location, bar_length) - delta = .01 if self.bar_textposition == 'outside' else -.01 + delta = .05 if self.bar_textposition == 'outside' else -.008 text_objs = [] for x1, y1 in zipped: @@ -425,7 +592,6 @@ def add_bar_labels(self, ax, bar_location, bar_length): text = self.bar_texttemplate.format(x=val) xtext, ytext = ax.transLimits.inverted().transform((xtext, ytext)) - text_obj = ax.text(xtext, ytext, text, clip_on=True, **self.bar_label_font) text_objs.append(text_obj) return text_objs @@ -452,6 +618,7 @@ def add_perpendicular_bar(self, ax, bar_length, i): line.set_ydata([val] * 2) def anim_func(self, i): + if i is None: return ax = self.fig.axes[0] @@ -460,12 +627,20 @@ def anim_func(self, i): start = int(bool(self.period_label)) for text in ax.texts[start:]: text.remove() + + if self.img_label_folder: + for artist in self.img_label_artist: + artist.remove() + self.img_label_artist = [] #clears the list of artists for the next cycle. self.plot_bars(ax, i) + # self.fig.tight_layout() + def make_animation(self): def init_func(): ax = self.fig.axes[0] self.plot_bars(ax, 0) + # self.fig.tight_layout() interval = self.period_length / self.steps_per_period pause = int(self.end_period_pause // interval) @@ -516,8 +691,9 @@ def bar_chart_race(df, filename=None, orientation='h', sort='desc', n_bars=None, perpendicular_bar_func=None, colors=None, title=None, bar_size=.95, bar_textposition='outside', bar_texttemplate='{x:,.0f}', bar_label_font=None, tick_label_font=None, tick_template='{x:,.0f}', - shared_fontdict=None, scale='linear', fig=None, writer=None, - bar_kwargs=None, fig_kwargs=None, filter_column_colors=False): + shared_fontdict=None, scale='linear', fig=None, writer=None, bar_kwargs=None, + fig_kwargs=None, filter_column_colors=False, + img_label_folder=None,tick_label_mode='image',tick_image_mode='trailing'): ''' Create an animated bar chart race using matplotlib. Data must be in 'wide' format where each row represents a single time period and each @@ -815,7 +991,31 @@ def func(val): EXPERIMENTAL This parameter is experimental and may be changed/removed in a later version. + + img_label_folder : `None` or str, default `None` + Folder that contains images to be used as labels in the chart. + The folder should contain one image per bar in the chart and + the filenames should match name of the corresponding column in the dataframe. + tick_label_mode : str, default `image` + Dictates what kind of tick label will be used for the bars. Depending on the + mode selected, only the image might show up, or both image and text. + For only text, simply use the default value of `None` for `img_label_folder` above. + + Possible keys are: + `image`, `mixed` + + DO NOT USE. I have not polished it and it does not look good. Just let it use the + default value `image` and everything will be fine. + + tick_image_mode : str, default `trailing` + Tells how to update image tick labels. `trailing` will make it so that the image is + always moving with the bar as it grows. `fixed` will keep the image at a fixed + location near the start of the bar. I have not decided on the best way to automate + the location. + + Possible keys are: + `trailing`, `fixed` Returns ------- When `filename` is left as `None`, an HTML5 video is returned as a string. @@ -872,5 +1072,6 @@ def func(val): period_label, period_template, period_summary_func, perpendicular_bar_func, colors, title, bar_size, bar_textposition, bar_texttemplate, bar_label_font, tick_label_font, tick_template, shared_fontdict, scale, - fig, writer, bar_kwargs, fig_kwargs, filter_column_colors) + fig, writer, bar_kwargs, fig_kwargs, filter_column_colors, + img_label_folder,tick_label_mode,tick_image_mode) return bcr.make_animation() diff --git a/bar_chart_race/_codes/code_value.csv b/bar_chart_race/_codes/code_value.csv deleted file mode 100644 index 471ed0c..0000000 --- a/bar_chart_race/_codes/code_value.csv +++ /dev/null @@ -1,3 +0,0 @@ -code,value -country,https://github.com/hjnilsson/country-flags/raw/master/png250px/{code}.png -nfl,self \ No newline at end of file diff --git a/bar_chart_race/_codes/country.csv b/bar_chart_race/_codes/country.csv deleted file mode 100644 index ddc8a06..0000000 --- a/bar_chart_race/_codes/country.csv +++ /dev/null @@ -1,1330 +0,0 @@ -code,value -ad,ad -and,ad -andorra,ad -principality of andorra,ad -principality of the valleys of andorra,ad -principat d'andorra,ad -ae,ae -al emirat al arabbiya al muttahida,ae -are,ae -the emirates,ae -trucial states,ae -u.a.e,ae -uae,ae -united arab emirates,ae -af,af -afghanistan,af -da afġānistān islāmī jumhoryat,af -islamic republic of afghanistan,af -jomhūrīyyeh eslāmīyyeh afġānestān,af -ag,ag -antigua and barbuda,ag -atg,ag -ai,ai -aia,ai -anguilla,ai -al,al -alb,al -albania,al -arbanon,al -arnavutluk,al -republic of albania,al -republika e shqipërisë,al -am,am -arm,am -armenia,am -hayastan,am -republic of armenia,am -ago,ao -angola,ao -ao,ao -antarctica,aq -aq,aq -ata,aq -ar,ar -arg,ar -argentina,ar -argentine confederation,ar -argentine nation,ar -argentine republic,ar -la argentina,ar -the argentine,ar -united provinces of the río de la plata,ar -american samoa,as -as,as -asm,as -at,at -austria,at -aut,at -republic of austria,at -republik österreich,at -österreich,at -au,au -aus,au -australia,au -commonwealth of australia,au -new holland,au -abw,aw -aruba,aw -aw,aw -ala,ax -ax,ax -åland islands,ax -åland,ax -aland,ax -aland islands,ax -az,az -aze,az -azerbaijan,az -azərbaycan respublikası,az -republic of azerbaijan,az -ba,ba -bih,ba -bosnia and herzegovina,ba -republic of bosnia and herzegovina,ba -socialist republic of bosnia and herzegovina,ba -barbados,bb -bb,bb -bimshire,bb -brb,bb -bangladesh,bd -bd,bd -bengal presidency,bd -bgd,bd -east bengal,bd -east pakistan,bd -people's republic of bangladesh,bd -be,be -bel,be -belgium,be -kingdom of belgium,be -koninkrijk belgië,be -königreich belgien,be -royaume de belgique,be -bf,bf -bfa,bf -bourkina-fasso,bf -burkina faso,bf -haute-volta,bf -upper volta,bf -bg,bg -bgr,bg -bulgaria,bg -people's republic of bulgaria,bg -republic of bulgaria,bg -republika bǎlgariya,bg -bahrain,bh -bh,bh -bhr,bh -kingdom of bahrain,bh -mamlakat al-baḥrayn,bh -state of bahrain,bh -bdi,bi -bi,bi -burundi,bi -kingdom of burundi,bi -republic of burundi,bi -republika y'uburundi,bi -république du burundi,bi -ben,bj -benin,bj -bj,bj -dahomey,bj -republic of benin,bj -république du bénin,bj -blm,bl -saint barthélemy,bl -bl,bl -bermuda,bm -bm,bm -bmu,bm -bn,bn -brn,bn -brunei,bn -brunei darussalam,bn -negara brunei darussalam,bn -state of brunei,bn -نڬارا بروني دارالسلام‎,bn -bo,bo -bol,bo -bolivia,bo -estado plurinacional de bolivia,bo -plurinational state of bolivia,bo -republic of bolivia,bo -republic of bolívar,bo -bes,bq -bq,bq -sint eustatius,bq -br,br -bra,br -brazil,br -empire of brazil,br -federative republic of brazil,br -ilha de vera cruz,br -pindorama,br -república federativa do brasil,br -terra de santa cruz,br -terra di papaga,br -united states of brazil,br -bahamas,bs -bhs,bs -bs,bs -commonwealth of the bahamas,bs -the bahamas,bs -bhutan,bt -bt,bt -btn,bt -druk gyal khap,bt -kingdom of bhutan,bt -bouvet island,bv -bv,bv -bvt,bv -bechuanaland,bw -botswana,bw -bw,bw -bwa,bw -republic of botswana,bw -belarus,by -blr,by -by,by -byelorussia,by -gudija,by -republic of belarus,by -white russia,by -belize,bz -blz,bz -british honduras,bz -bz,bz -ca,ca -can,ca -canada,ca -dominion du canada,ca -dominion of canada,ca -cck,cc -cc,cc -cocos islands,cc -cocos (keeling) islands,cc -keeling islands,cc -territory of cocos islands,cc -belgian congo,cd -cd,cd -cod,cd -congo belge,cd -congo free state,cd -congo kinshasa,cd -democratic republic of congo,cd -congo (kinshasa),cd -drc,cd -zaire,cd -caf,cf -central african empire,cf -central african republic,cf -cf,cf -empire centrafricain,cf -oubangui-chari,cf -république centrafricaine,cf -ubangi-shari,cf -cg,cg -cog,cg -congo,cg -congo brazzaville,cg -french congo,cg -republic of the congo,cg -congo (brazzaville),cg -the congo,cg -ch,ch -che,ch -confederazione svizzera,ch -confederaziun svizra,ch -confédération suisse,ch -schweiz,ch -schweizerische eidgenossenschaft,ch -suisse,ch -svizra,ch -svizzera,ch -swiss confederation,ch -switzerland,ch -ci,ci -civ,ci -côte d'ivoire,ci -ivory coast,ci -cote d'ivoire,ci -republic of côte d'ivoire,ci -république de côte d'ivoire,ci -the ivory coast,ci -cok,ck -ck,ck -cook islands,ck -capitania general de chile,cl -chile,cl -chili,cl -chilli,cl -chl,cl -cl,cl -republic of chile,cl -reyno de chile,cl -cameroon,cm -cm,cm -cmr,cm -kamerun,cm -republic of cameroon,cm -united republic of cameroon,cm -china,cn -chn,cn -cn,cn -communist china,cn -people's republic of china,cn -red china,cn -co,co -col,co -colombia,co -confederación granadina,co -estados unidos de colombia,co -republic of colombia,co -república de colombia,co -república de la nueva granada,co -costa rica,cr -cr,cr -cri,cr -republic of costa rica,cr -república de costa rica,cr -cu,cu -cub,cu -cuba,cu -republic of cuba,cu -república de cuba,cu -cabo verde,cv -cape verde,cv -cpv,cv -cv,cv -curaçao,cw -cuw,cw -cw,cw -christmas island,cx -cx,cx -cxr,cx -cy,cy -cyp,cy -cyprus,cy -bohemia,cz -cz,cz -cze,cz -czech republic,cz -czechia,cz -czechland,cz -koruna česká,cz -the czechlands,cz -čechy a morava,cz -česko,cz -česká konfederace,cz -česká republika,cz -alemania,de -allemagne,de -bundesrepublik deutschland,de -de,de -deu,de -deutschland,de -federal republic of germany,de -german democratic republic,de -germania,de -germany,de -dj,dj -dji,dj -djibouti,dj -republic of djibouti,dj -république de djibouti,dj -danmark,dk -denmark,dk -dk,dk -dnk,dk -kingdom of denmark,dk -kongeriget danmark,dk -dm,dm -dma,dm -dominica,dm -do,do -dom,do -dominican republic,do -al-jazā’ir,dz -algeria,dz -dz,dz -dza,dz -people's democratic republic of algeria,dz -ec,ec -ecu,ec -ecuador,ec -ee,ee -eesti,ee -est,ee -estland,ee -estonia,ee -aegyptus,eg -arab republic of egypt,eg -eg,eg -egy,eg -egypt,eg -esh,eh -western sahara,eh -the sahrawi arab democratic republic,eh -er,er -eri,er -eritrea,er -es,es -esp,es -espainia,es -espanya,es -españa,es -kingdom of spain,es -spain,es -spanish state,es -abyssinia,et -al-habasha,et -et,et -eth,et -ethiopia,et -ethiopië,et -federal democratic republic of ethiopia,et -habeshastan,et -fi,fi -fin,fi -finland,fi -republic of finland,fi -republiken finland,fi -soome,fi -suomen tasavalta,fi -suomenmaa,fi -suomi,fi -suomâ and suomâ täsiväldi,fi -suopma and suoma dásseváldi,fi -fiji,fj -fj,fj -fji,fj -falkland islands,fk -fk,fk -flk,fk -fm,fm -fsm,fm -micronesia,fm -fro,fo -fo,fo -faroe,fo -faroe islands,fo -the faroe,fo -the faroe islands,fo -farança,fr -fr,fr -fra,fr -france,fr -french republic,fr -gaul,fr -gaule,fr -l'hexagone,fr -république française,fr -tsarfat,fr -γαλλία,fr -ga,ga -gab,ga -gabon,ga -gabonese republic,ga -anglia,gb -britain,gb -britannia,gb -caledonia,gb -gb,gb -gbr,gb -great britain,gb -u.k.,gb -uk,gb -united kingdom,gb -united kingdom of great britain and northern ireland,gb -gd,gd -grd,gd -grenada,gd -colchis,ge -ge,ge -geo,ge -georgia,ge -iveria,ge -republic of georgia,ge -گرجستان,ge -french guiana,gf -gf,gf -guf,gf -gg,gg -ggy,gg -guernsey,gg -gaana,gh -gh,gh -gha,gh -ghana,gh -ghana tiŋzuɣu,gh -gold coast,gh -united gold coast convention,gh -gi,gi -gib,gi -gibraltar,gi -gl,gl -greenland,gl -grl,gl -gm,gm -gmb,gm -the gambia,gm -gambia,gm -gambia (the),gm -the republic of gambia,gm -gin,gn -gn,gn -guinea,gn -glp,gp -gp,gp -guadeloupe,gp -equatorial guinea,gq -gnq,gq -gq,gq -gr,gr -grc,gr -greece,gr -hellas,gr -hellenic republic,gr -yavan,gr -yunanistan,gr -ελλάδα,gr -ελλάς,gr -sgs,gs -gs,gs -south georgia and the south sandwich islands,gs -gt,gt -gtm,gt -guatemala,gt -gu,gu -guam,gu -gum,gu -gnb,gw -guinea-bissau,gw -guiné-bissao,gw -gw,gw -portuguese guinea,gw -republic of guinea-bissau,gw -guy,gy -guyana,gy -gy,gy -hk,hk -hkg,hk -hong kong,hk -hmd,hm -hm,hm -heard island and mcdonald islands,hm -territory of heard island and mcdonald islands,hm -hn,hn -hnd,hn -honduras,hn -croatia,hr -hr,hr -hrv,hr -hrvatska,hr -hrvaška,hr -republic of croatia,hr -republika hrvatska,hr -haiti,ht -ht,ht -hti,ht -hu,hu -hun,hu -hungaria,hu -hungarian people's republic,hu -hungary,hu -kingdom of hungary,hu -magyar királyság,hu -magyar köztársaság,hu -magyar népköztársaság,hu -magyar tanácsköztársaság,hu -magyarország,hu -regnum hungariæ,hu -republic of hungary,hu -hindia belanda,id -id,id -idn,id -indonesia,id -indonesië,id -indunesia,id -insulinde,id -nederlands,id -nusantara,id -republic of indonesia,id -republik indonesia,id -hibernia,ie -ie,ie -ireland,ie -irish free state,ie -irl,ie -republic of ireland,ie -herzlstan,il -il,il -isr,il -israel,il -state of israel,il -yehuda,il -imn,im -im,im -isle of man,im -hindustan,in -in,in -ind,in -india,in -republic of india,in -union of india,in -भारत,in -भारतवर्ष,in -iot,io -io,io -british indian ocean territory,io -assyria,iq -babylon,iq -iq,iq -iraq,iq -irq,iq -mesopotamia,iq -ir,ir -iran,ir -irn,ir -islamic republic of iran,ir -persia,ir -iceland,is -is,is -isl,is -lýðveldið ísland,is -republic of iceland,is -it,it -ita,it -italia,it -italy,it -repubblica italiana,it -the beautiful country,it -the boot,it -je,je -jersey,je -jey,je -jam,jm -jamaica,jm -jm,jm -xamayca,jm -hashemite kingdom of jordan,jo -jo,jo -jor,jo -jordan,jo -japan,jp -jp,jp -jpn,jp -nihon,jp -nippon,jp -yamato,jp -ōyashima,jp -british east africa protectorate,ke -jamhuri ya kenya,ke -ke,ke -ken,ke -kenya,ke -kenya colony,ke -republic of kenya,ke -kg,kg -kgz,kg -kirghiz soviet socialist republic,kg -kirghizia,kg -kirgizstan,kg -kyrgyz republic,kg -kyrgyzskaya respublika,kg -kyrgyzstan,kg -republic of kyrgyzstan,kg -кыргызстан,kg -cambodia,kh -democratic kampuchea,kh -kampuchea,kh -kh,kh -khm,kh -khmer republic,kh -kingdom of cambodia,kh -people's republic of kampuchea,kh -royaume du cambodge,kh -state of cambodia,kh -ki,ki -kir,ki -kiribati,ki -al-ittiḥād al-qumurī,km -com,km -comoros,km -km,km -udzima wa komori,km -union des comores,km -union of the comoros,km -united republic of the commoros,km -federation of saint christopher and nevis,kn -federation of saint kitts and nevis,kn -kn,kn -kna,kn -liamuiga and oualie,kn -saint christopher and nevis,kn -saint christopher-nevis-anguilla,kn -saint kitts and nevis,kn -saint kitts-nevis-anguilla,kn -cho-son,kp -choson minjujuui inmin konghwaguk,kp -d.p.r.k.,kp -democratic people's republic of korea,kp -dprk,kp -kp,kp -north korea,kp -prk,kp -dae-han-min-guk,kr -han-guk,kr -kor,kr -korea,kr -korea republic,kr -kr,kr -republic of korea,kr -south korea,kr -"korea, south",kr -kuwait,kw -kw,kw -kwt,kw -cayman islands,ky -cym,ky -ky,ky -kaz,kz -kazakh soviet socialist republic,kz -kazakhstan,kz -kz,kz -qazaqstan,kz -republic of kazakhstan,kz -қазақстан,kz -қазақстан республикасы,kz -la,la -lao,la -lao people's democratic republic,la -laos,la -république démocratique populaire lao,la -sathalanalat paxathipatai paxaxôn,la -ສາທາລະນະລັດ ປະຊາທິປະໄຕ ປະຊາຊົນລາວ,la -al-jumhuriyya al-lubnaniyya,lb -lb,lb -lbn,lb -lebanon,lb -lebnan,lb -levanon,lb -liban,lb -lubnan,lb -the lebanese republic,lb -lc,lc -lca,lc -saint lucia,lc -li,li -lie,li -liechtenstein,li -ceylon,lk -democratic socialist republic of sri lanka,lk -heladiva,lk -lk,lk -lka,lk -ratnadeepa,lk -sri lanka,lk -taprobane,lk -lbr,lr -liberia,lr -lr,lr -basutoland,ls -kingdom of lesotho,ls -lesotho,ls -ls,ls -lso,ls -lietuva,lt -lietuvos respublika,lt -lita,lt -lithuania,lt -lt,lt -ltu,lt -литва,lt -grand duchy of luxembourg,lu -grand-duché de luxembourg,lu -groussherzogdem lëtzebuerg,lu -großherzogtum luxemburg,lu -lu,lu -lussemburgo,lu -lux,lu -luxembourg,lu -luxemburg,lu -luxemburgo,lu -lëtzebuerg,lu -latvia,lv -latvija,lv -letland,lv -letonija,lv -letonnie,lv -lettland,lv -lv,lv -lva,lv -lby,ly -libya,ly -ly,ly -al mamkaka al maghribiya,ma -kingdom of morocco,ma -ma,ma -mar,ma -morocco,ma -mc,mc -mco,mc -monaco,mc -boğdan,md -md,md -mda,md -moldau,md -moldavia,md -moldavian soviet socialist republic,md -moldova,md -republic of moldova,md -republica moldova,md -me,me -mne,me -montenegro,me -republic of montenegro,me -maf,mf -mf,mf -collectivity of saint martin,mf -saint martin,mf -madagascar,mg -madagasikara,mg -mdg,mg -mg,mg -repoblikan'i madagasikara,mg -republic of madagascar,mg -république de madagascar,mg -mhl,mh -mh,mh -marshall islands,mh -macedonia,mk -mk,mk -mkd,mk -north macedonia,mk -paeonia,mk -republic of north macedonia,mk -vardar banovina,mk -македонија,mk -северна македонија,mk -mali,ml -ml,ml -mli,ml -burma,mm -mm,mm -mmr,mm -myanmar,mm -republic of the union of myanmar,mm -mng,mn -mongolia,mn -the state of mongolia,mn -mac,mo -macao,mo -mo,mo -mnp,mp -mp,mp -northern mariana islands,mp -martinique,mq -mq,mq -mtq,mq -islamic republic of mauritania,mr -mauritania,mr -mr,mr -mrt,mr -république islamique de mauritanie,mr -montserrat,ms -ms,ms -msr,ms -malta,mt -mlt,mt -mt,mt -mauritius,mu -mu,mu -mus,mu -maldives,mv -mdv,mv -mv,mv -republic of the maldives,mv -the maldive islands,mv -malawi,mw -mw,mw -mwi,mw -nyasaland,mw -republic of malawi,mw -aztlán,mx -aztlān,mx -estados unidos mexicanos,mx -mex,mx -mexico,mx -mx,mx -méjico,mx -méxico,mx -república mexicana,mx -united mexican states,mx -federation of malaysia,my -malaysia,my -my,my -mys,my -persekutuan malaysia,my -moz,mz -mozambique,mz -mz,mz -namibia,na -na,na -nam,na -nc,nc -ncl,nc -new caledonia,nc -ne,ne -ner,ne -niger,ne -nf,nf -nfk,nf -norfolk island,nf -ng,ng -nga,ng -nigeria,ng -ni,ni -nic,ni -nicaragua,ni -batavia,nl -holland,nl -kingdom of the netherlands,nl -koninkrijk der nederlanden,nl -nederland,nl -netherlands,nl -nl,nl -nld,nl -pays-bas,nl -kingdom of norway,no -kongeriket noreg,no -kongeriket norge,no -no,no -nor,no -noreg,no -norge,no -norway,no -federal democratic republic of nepal,np -nepal,np -np,np -npl,np -nauru,nr -nr,nr -nru,nr -niu,nu -niue,nu -nu,nu -aotearoa,nz -dominion of new zealand,nz -new zealand,nz -nz,nz -nzl,nz -realm of new zealand,nz -om,om -oman,om -omn,om -sultanate of oman,om -pa,pa -pan,pa -panama,pa -pe,pe -per,pe -peru,pe -peruvian republic,pe -perú,pe -republic of peru,pe -república del perú,pe -república peruana,pe -french polynesia,pf -pf,pf -pyf,pf -papua new guinea,pg -pg,pg -png,pg -filipina,ph -filipinas,ph -haríng bayang katagalugan,ph -islas de san lázaro,ph -las islas felipenas,ph -las islas filipinas,ph -ph,ph -philippine islands,ph -philippines,ph -phl,ph -pilipinas,ph -pinás,ph -republic of the philippines,ph -repúblika ng pilipinas,ph -dominion of pakistan,pk -federation of pakistan,pk -islamic republic of pakistan,pk -mumlikat-e khudadaad pakistan,pk -pak,pk -pakistan,pk -pk,pk -sindhustan and indoscythia,pk -west pakistan,pk -lechia,pl -people's republic of poland,pl -pl,pl -pol,pl -poland,pl -polish-lithuanian commonwealth,pl -polonia,pl -polska,pl -republic of poland,pl -spm,pm -pm,pm -saint pierre and miquelon,pm -pcn,pn -pn,pn -pitcairn,pn -"pitcairn, henderson, ducie and oeno islands",pn -associated free state of puerto rico,pr -commonwealth of puerto rico,pr -estado libre asociado de puerto rico,pr -porto rico,pr -pr,pr -pri,pr -puerto rico,pr -israeli-occupied territories,ps -mandatory palestine,ps -palestine,ps -palestinian national authority,ps -palestinian territories,ps -ps,ps -pse,ps -state of palestine,ps -west bank and gaza strip,ps -west bank and gaza,ps -and galician-portuguese,pt -and pátria lusitana,pt -lusitania,pt -portugal,pt -portuguese republic,pt -prt,pt -pt,pt -belau,pw -palau,pw -plw,pw -pw,pw -republic of palau,pw -paraguay,py -pry,py -py,py -qa,qa -qat,qa -qatar,qa -reu,re -re,re -réunion,re -reunion,re -kingdom of romania,ro -regatul româniei,ro -republica populară romînă,ro -republica socialistă românia,ro -ro,ro -romania,ro -romanian people's republic,ro -românia,ro -rou,ro -socialist republic of romania,ro -raška,rs -republic of serbia,rs -republika srbija,rs -rs,rs -serbia,rs -serbia and montenegro,rs -serboslavia,rs -servia,rs -srb,rs -srbija,rs -yugoslavia,rs -ru,ru -rus,ru -russia,ru -russian federation,ru -russian socialist federative soviet republic,ru -russian soviet federative socialist republic,ru -soviet union,ru -union of soviet socialist republics,ru -ussr,ru -republic of rwanda,rw -repubulika y'u rwanda,rw -ruanda,rw -rw,rw -rwa,rw -rwanda,rw -rwandese republic,rw -république du rwanda,rw -kingdom of saudi arabia,sa -ksa,sa -sa,sa -sau,sa -saudi arabia,sa -saudia,sa -sb,sb -slb,sb -solomon islands,sb -sc,sc -seychelles,sc -syc,sc -anglo-egyptian sudan,sd -mahdist state,sd -nubia,sd -republic of the sudan,sd -sd,sd -sdn,sd -sudan,sd -the sudan,sd -kingdom of sweden,se -konungariket sverige,se -se,se -svea rike,se -sverige,se -svitjod,se -swe,se -sweden,se -pulau ujong,sg -republic of singapore,sg -sg,sg -sgp,sg -singapore,sg -singapura,sg -sinhapura,sg -shn,sh -sh,sh -saint helena,sh -"saint helena, ascension and tristan da cunha",sh -republic of slovenia,si -republika slovenija,si -si,si -slovenia,si -slovenija,si -svn,si -sjm,sj -sj,sj -svalbard and jan mayen,sj -sk,sk -slovak republic,sk -slovak socialist republic,sk -slovakia,sk -slovensko,sk -slovenská republika,sk -slovenská socialistická republika,sk -svk,sk -sierra leone,sl -sl,sl -sle,sl -san marino,sm -sm,sm -smr,sm -sen,sn -senegal,sn -sn,sn -so,so -som,so -somalia,so -dutch guiana,sr -netherlands guiana,sr -republic of suriname,sr -republiek suriname,sr -sr,sr -sur,sr -surinam,sr -suriname,sr -south sudan,ss -ss,ss -ssd,ss -sao tome and principe,st -st,st -stp,st -el salvador,sv -slv,sv -sv,sv -sxm,sx -sx,sx -sint maarten,sx -sy,sy -syr,sy -syria,sy -eswatini,sz -kingdom of eswatini,sz -swaziland,sz -swz,sz -sz,sz -tc,tc -tca,tc -turks and caicos,tc -chad,td -jumhūrīyat tashād,td -republic of chad,td -république du tchad,td -tcd,td -td,td -atf,tf -tf,tf -french southern territories,tf -french southern and antarctic lands,tf -tg,tg -tgo,tg -togo,tg -kingdom of thailand,th -siam,th -th,th -tha,th -thailand,th -ประเทศสยาม,th -ประเทศไทย,th -ราชอาณาจักรไทย,th -tajikistan,tj -tj,tj -tjk,tj -tk,tk -tkl,tk -tokelau,tk -democratic republic of timor-leste,tl -east timor,tl -timor-leste,tl -tl,tl -tls,tl -tkm,tm -tm,tm -turkmenistan,tm -republic of tunisia,tn -tn,tn -tun,tn -tunisia,tn -to,to -ton,to -tonga,to -anatolia,tr -ottoman empire,tr -republic of turkey,tr -tr,tr -tur,tr -turkey,tr -iere,tt -republic of trinidad and tobago,tt -trinbago,tt -trinidad and tobago,tt -tt,tt -tto,tt -ellice islands,tv -tuv,tv -tuvalu,tv -tv,tv -cathay,tw -formosa,tw -republic of china,tw -roc,tw -taiwan,tw -tw,tw -twn,tw -zhonggua taipei,tw -zhongguo,tw -tanzania,tz -tz,tz -tza,tz -united republic of tanganyika and zanzibar,tz -united republic of tanzania,tz -ua,ua -ukr,ua -ukraine,ua -україна,ua -ug,ug -uga,ug -uganda,ug -umi,um -um,um -united states minor outlying islands,um -u.s.a,us -united states,us -united states of america,us -us,us -usa,us -uruguay,uy -ury,uy -uy,uy -uz,uz -uzb,uz -uzbekistan,uz -va,va -vat,va -vatican city,va -holy see,va -the holy see,va -holy see (the),va -hairouna,vc -saint vincent and the grenadines,vc -vc,vc -vct,vc -ve,ve -ven,ve -venezuela,ve -vgb,vg -vg,vg -british virgin islands,vg -bvi,vg -virgin islands,vg -vir,vi -vi,vi -usvi,vi -united states virgin islands,vi -american virgin islands,vi -u.s. virgin islands,vi -virgin islands of the united states,vi -an nam,vn -and south vietnam,vn -champa,vn -french indochina,vn -giao chỉ,vn -lĩnh nam,vn -parted in north vietnam,vn -socialist republic of vietnam,vn -vietnam,vn -việt nam,vn -vn,vn -vnm,vn -đại việt,vn -vanuatri,vu -vanuatu,vu -vu,vu -vut,vu -wlf,wf -wf,wf -wallis and futuna,wf -territory of the wallis and futuna isla,wf -samoa,ws -ws,ws -wsm,ws -kosovo,xk -republic of kosovo,xk -republika e kosovës,xk -republika kosovo,xk -xk,xk -република косово,xk -ye,ye -yem,ye -yemen,ye -mayotte,yt -myt,yt -yt,yt -south africa,za -suid-afrika,za -union of south africa,za -za,za -zaf,za -zuid-afrika,za -northern rhodesia,zm -republic of zambia,zm -zambia,zm -zm,zm -zmb,zm -republic of zimbabwe,zw -southern rhodesia,zw -zimbabwe,zw -zw,zw -zwe,zw diff --git a/bar_chart_race/_codes/nfl.csv b/bar_chart_race/_codes/nfl.csv deleted file mode 100644 index 275fdc1..0000000 --- a/bar_chart_race/_codes/nfl.csv +++ /dev/null @@ -1,33 +0,0 @@ -code,value -arizona cardinals,https://www.thesportsdb.com/images/media/team/badge/xvuwtw1420646838.png/preview -atlanta falcons,https://www.thesportsdb.com/images/media/team/badge/rrpvpr1420658174.png/preview -baltimore ravens,https://www.thesportsdb.com/images/media/team/badge/einz3p1546172463.png/preview -buffalo bills,https://www.thesportsdb.com/images/media/team/badge/6pb37b1515849026.png/preview -carolina panthers,https://www.thesportsdb.com/images/media/team/badge/xxyvvy1420940478.png/preview -chicago bears,https://www.thesportsdb.com/images/media/team/badge/uwtwtv1420941123.png/preview -cincinnati bengals,https://www.thesportsdb.com/images/media/team/badge/qqtwwv1420941670.png/preview -cleveland browns,https://www.thesportsdb.com/images/media/team/badge/squvxy1420942389.png/preview -dallas cowboys,https://www.thesportsdb.com/images/media/team/badge/wrxssu1450018209.png/preview -denver broncos,https://www.thesportsdb.com/images/media/team/badge/upsspx1421635647.png/preview -detroit lions,https://www.thesportsdb.com/images/media/team/badge/lgsgkr1546168257.png/preview -green bay packers,https://www.thesportsdb.com/images/media/team/badge/rqpwtr1421434717.png/preview -houston texans,https://www.thesportsdb.com/images/media/team/badge/wqyryy1421436627.png/preview -indianapolis colts,https://www.thesportsdb.com/images/media/team/badge/wqqvpx1421434058.png/preview -jacksonville jaguars,https://www.thesportsdb.com/images/media/team/badge/0mrsd41546427902.png/preview -kansas city chiefs,https://www.thesportsdb.com/images/media/team/badge/936t161515847222.png/preview -las vegas raiders,https://www.thesportsdb.com/images/media/team/badge/xqusqy1421724291.png/preview -los angeles chargers,https://www.thesportsdb.com/images/media/team/badge/wbhu3a1548320628.png/preview -los angeles rams,https://www.thesportsdb.com/images/media/team/badge/45ps1l1515847886.png/preview -miami dolphins,https://www.thesportsdb.com/images/media/team/badge/trtusv1421435081.png/preview -minnesota vikings,https://www.thesportsdb.com/images/media/team/badge/qstqqr1421609163.png/preview -new england patriots,https://www.thesportsdb.com/images/media/team/badge/xtwxyt1421431860.png/preview -new orleans saints,https://www.thesportsdb.com/images/media/team/badge/nd46c71537821337.png/preview -new york giants,https://www.thesportsdb.com/images/media/team/badge/vxppup1423669459.png/preview -new york jets,https://www.thesportsdb.com/images/media/team/badge/rurvuu1421435228.png/preview -philadelphia eagles,https://www.thesportsdb.com/images/media/team/badge/pnpybf1515852421.png/preview -pittsburgh steelers,https://www.thesportsdb.com/images/media/team/badge/2975411515853129.png/preview -san francisco 49ers,https://www.thesportsdb.com/images/media/team/badge/bqbtg61539537328.png/preview -seattle seahawks,https://www.thesportsdb.com/images/media/team/badge/wwuqyr1421434817.png/preview -tampa bay buccaneers,https://www.thesportsdb.com/images/media/team/badge/2dfpdl1537820969.png/preview -tennessee titans,https://www.thesportsdb.com/images/media/team/badge/m48yia1515847376.png/preview -washington redskins,https://www.thesportsdb.com/images/media/team/badge/qsxwrv1425081054.png/preview diff --git a/bar_chart_race/_colormaps.py b/bar_chart_race/_colormaps.py index 59dc289..ec50de4 100644 --- a/bar_chart_race/_colormaps.py +++ b/bar_chart_race/_colormaps.py @@ -1,5 +1,27 @@ colormaps = \ { + "brand_colors": [ + '#6ECBCE', + '#FF2243', + '#FFC33D', + '#CE9673', + '#FFA0FF', + '#6501E5', + '#F79522', + '#699AF8', + '#34718E', + '#00DBCD', + '#00A3FF', + '#F8A737', + '#56BD5B', + '#D40CE5', + '#6936F9', + '#FF317B', + '#0000F3', + '#FFA0A0', + '#31FF83', + '#0556F3' + ], "dark12": [ '#2E91E5', '#1CA71C', diff --git a/data/baseball.csv b/data/baseball.csv deleted file mode 100644 index 08aaf7e..0000000 --- a/data/baseball.csv +++ /dev/null @@ -1,430 +0,0 @@ -name,year,hr -Hank Aaron,0,0 -Barry Bonds,0,0 -Jimmie Foxx,0,0 -Ken Griffey,0,0 -Reggie Jackson,0,0 -Harmon Killebrew,0,0 -Mickey Mantle,0,0 -Willie Mays,0,0 -Willie McCovey,0,0 -Mark McGwire,0,0 -David Ortiz,0,0 -Rafael Palmeiro,0,0 -Albert Pujols,0,0 -Manny Ramirez,0,0 -Frank Robinson,0,0 -Alex Rodriguez,0,0 -Babe Ruth,0,0 -Mike Schmidt,0,0 -Sammy Sosa,0,0 -Jim Thome,0,0 -Hank Aaron,1,13 -Hank Aaron,2,40 -Hank Aaron,3,66 -Hank Aaron,4,110 -Hank Aaron,5,140 -Hank Aaron,6,179 -Hank Aaron,7,219 -Hank Aaron,8,253 -Hank Aaron,9,298 -Hank Aaron,10,342 -Hank Aaron,11,366 -Hank Aaron,12,398 -Hank Aaron,13,442 -Hank Aaron,14,481 -Hank Aaron,15,510 -Hank Aaron,16,554 -Hank Aaron,17,592 -Hank Aaron,18,639 -Hank Aaron,19,673 -Hank Aaron,20,713 -Hank Aaron,21,733 -Hank Aaron,22,745 -Hank Aaron,23,755 -Barry Bonds,1,16 -Barry Bonds,2,41 -Barry Bonds,3,65 -Barry Bonds,4,84 -Barry Bonds,5,117 -Barry Bonds,6,142 -Barry Bonds,7,176 -Barry Bonds,8,222 -Barry Bonds,9,259 -Barry Bonds,10,292 -Barry Bonds,11,334 -Barry Bonds,12,374 -Barry Bonds,13,411 -Barry Bonds,14,445 -Barry Bonds,15,494 -Barry Bonds,16,567 -Barry Bonds,17,613 -Barry Bonds,18,658 -Barry Bonds,19,703 -Barry Bonds,20,708 -Barry Bonds,21,734 -Barry Bonds,22,762 -Jimmie Foxx,1,0 -Jimmie Foxx,2,0 -Jimmie Foxx,3,3 -Jimmie Foxx,4,16 -Jimmie Foxx,5,49 -Jimmie Foxx,6,86 -Jimmie Foxx,7,116 -Jimmie Foxx,8,174 -Jimmie Foxx,9,222 -Jimmie Foxx,10,266 -Jimmie Foxx,11,302 -Jimmie Foxx,12,343 -Jimmie Foxx,13,379 -Jimmie Foxx,14,429 -Jimmie Foxx,15,464 -Jimmie Foxx,16,500 -Jimmie Foxx,17,519 -Jimmie Foxx,18,527 -Jimmie Foxx,19,527 -Jimmie Foxx,20,534 -Ken Griffey,1,16 -Ken Griffey,2,38 -Ken Griffey,3,60 -Ken Griffey,4,87 -Ken Griffey,5,132 -Ken Griffey,6,172 -Ken Griffey,7,189 -Ken Griffey,8,238 -Ken Griffey,9,294 -Ken Griffey,10,350 -Ken Griffey,11,398 -Ken Griffey,12,438 -Ken Griffey,13,460 -Ken Griffey,14,468 -Ken Griffey,15,481 -Ken Griffey,16,501 -Ken Griffey,17,536 -Ken Griffey,18,563 -Ken Griffey,19,593 -Ken Griffey,20,611 -Ken Griffey,21,630 -Ken Griffey,22,630 -Reggie Jackson,1,1 -Reggie Jackson,2,30 -Reggie Jackson,3,77 -Reggie Jackson,4,100 -Reggie Jackson,5,132 -Reggie Jackson,6,157 -Reggie Jackson,7,189 -Reggie Jackson,8,218 -Reggie Jackson,9,254 -Reggie Jackson,10,281 -Reggie Jackson,11,313 -Reggie Jackson,12,340 -Reggie Jackson,13,369 -Reggie Jackson,14,410 -Reggie Jackson,15,425 -Reggie Jackson,16,464 -Reggie Jackson,17,478 -Reggie Jackson,18,503 -Reggie Jackson,19,530 -Reggie Jackson,20,548 -Reggie Jackson,21,563 -Harmon Killebrew,1,0 -Harmon Killebrew,2,4 -Harmon Killebrew,3,9 -Harmon Killebrew,4,11 -Harmon Killebrew,5,11 -Harmon Killebrew,6,53 -Harmon Killebrew,7,84 -Harmon Killebrew,8,130 -Harmon Killebrew,9,178 -Harmon Killebrew,10,223 -Harmon Killebrew,11,272 -Harmon Killebrew,12,297 -Harmon Killebrew,13,336 -Harmon Killebrew,14,380 -Harmon Killebrew,15,397 -Harmon Killebrew,16,446 -Harmon Killebrew,17,487 -Harmon Killebrew,18,515 -Harmon Killebrew,19,541 -Harmon Killebrew,20,546 -Harmon Killebrew,21,559 -Harmon Killebrew,22,573 -Mickey Mantle,1,13 -Mickey Mantle,2,36 -Mickey Mantle,3,57 -Mickey Mantle,4,84 -Mickey Mantle,5,121 -Mickey Mantle,6,173 -Mickey Mantle,7,207 -Mickey Mantle,8,249 -Mickey Mantle,9,280 -Mickey Mantle,10,320 -Mickey Mantle,11,374 -Mickey Mantle,12,404 -Mickey Mantle,13,419 -Mickey Mantle,14,454 -Mickey Mantle,15,473 -Mickey Mantle,16,496 -Mickey Mantle,17,518 -Mickey Mantle,18,536 -Willie Mays,1,20 -Willie Mays,2,24 -Willie Mays,3,65 -Willie Mays,4,116 -Willie Mays,5,152 -Willie Mays,6,187 -Willie Mays,7,216 -Willie Mays,8,250 -Willie Mays,9,279 -Willie Mays,10,319 -Willie Mays,11,368 -Willie Mays,12,406 -Willie Mays,13,453 -Willie Mays,14,505 -Willie Mays,15,542 -Willie Mays,16,564 -Willie Mays,17,587 -Willie Mays,18,600 -Willie Mays,19,628 -Willie Mays,20,646 -Willie Mays,21,654 -Willie Mays,22,660 -Willie McCovey,1,13 -Willie McCovey,2,26 -Willie McCovey,3,44 -Willie McCovey,4,64 -Willie McCovey,5,108 -Willie McCovey,6,126 -Willie McCovey,7,165 -Willie McCovey,8,201 -Willie McCovey,9,232 -Willie McCovey,10,268 -Willie McCovey,11,313 -Willie McCovey,12,352 -Willie McCovey,13,370 -Willie McCovey,14,384 -Willie McCovey,15,413 -Willie McCovey,16,435 -Willie McCovey,17,458 -Willie McCovey,18,465 -Willie McCovey,19,493 -Willie McCovey,20,505 -Willie McCovey,21,520 -Willie McCovey,22,521 -Mark McGwire,1,3 -Mark McGwire,2,52 -Mark McGwire,3,84 -Mark McGwire,4,117 -Mark McGwire,5,156 -Mark McGwire,6,178 -Mark McGwire,7,220 -Mark McGwire,8,229 -Mark McGwire,9,238 -Mark McGwire,10,277 -Mark McGwire,11,329 -Mark McGwire,12,387 -Mark McGwire,13,457 -Mark McGwire,14,522 -Mark McGwire,15,554 -Mark McGwire,16,583 -David Ortiz,1,1 -David Ortiz,2,10 -David Ortiz,3,10 -David Ortiz,4,20 -David Ortiz,5,38 -David Ortiz,6,58 -David Ortiz,7,89 -David Ortiz,8,130 -David Ortiz,9,177 -David Ortiz,10,231 -David Ortiz,11,266 -David Ortiz,12,289 -David Ortiz,13,317 -David Ortiz,14,349 -David Ortiz,15,378 -David Ortiz,16,401 -David Ortiz,17,431 -David Ortiz,18,466 -David Ortiz,19,503 -David Ortiz,20,541 -Rafael Palmeiro,1,3 -Rafael Palmeiro,2,17 -Rafael Palmeiro,3,25 -Rafael Palmeiro,4,33 -Rafael Palmeiro,5,47 -Rafael Palmeiro,6,73 -Rafael Palmeiro,7,95 -Rafael Palmeiro,8,132 -Rafael Palmeiro,9,155 -Rafael Palmeiro,10,194 -Rafael Palmeiro,11,233 -Rafael Palmeiro,12,271 -Rafael Palmeiro,13,314 -Rafael Palmeiro,14,361 -Rafael Palmeiro,15,400 -Rafael Palmeiro,16,447 -Rafael Palmeiro,17,490 -Rafael Palmeiro,18,528 -Rafael Palmeiro,19,551 -Rafael Palmeiro,20,569 -Albert Pujols,1,37 -Albert Pujols,2,71 -Albert Pujols,3,114 -Albert Pujols,4,160 -Albert Pujols,5,201 -Albert Pujols,6,250 -Albert Pujols,7,282 -Albert Pujols,8,319 -Albert Pujols,9,366 -Albert Pujols,10,408 -Albert Pujols,11,445 -Albert Pujols,12,475 -Albert Pujols,13,492 -Albert Pujols,14,520 -Albert Pujols,15,560 -Albert Pujols,16,591 -Albert Pujols,17,614 -Albert Pujols,18,633 -Albert Pujols,19,656 -Manny Ramirez,1,2 -Manny Ramirez,2,19 -Manny Ramirez,3,50 -Manny Ramirez,4,83 -Manny Ramirez,5,109 -Manny Ramirez,6,154 -Manny Ramirez,7,198 -Manny Ramirez,8,236 -Manny Ramirez,9,277 -Manny Ramirez,10,310 -Manny Ramirez,11,347 -Manny Ramirez,12,390 -Manny Ramirez,13,435 -Manny Ramirez,14,470 -Manny Ramirez,15,490 -Manny Ramirez,16,527 -Manny Ramirez,17,546 -Manny Ramirez,18,555 -Manny Ramirez,19,555 -Frank Robinson,1,38 -Frank Robinson,2,67 -Frank Robinson,3,98 -Frank Robinson,4,134 -Frank Robinson,5,165 -Frank Robinson,6,202 -Frank Robinson,7,241 -Frank Robinson,8,262 -Frank Robinson,9,291 -Frank Robinson,10,324 -Frank Robinson,11,373 -Frank Robinson,12,403 -Frank Robinson,13,418 -Frank Robinson,14,450 -Frank Robinson,15,475 -Frank Robinson,16,503 -Frank Robinson,17,522 -Frank Robinson,18,552 -Frank Robinson,19,574 -Frank Robinson,20,583 -Frank Robinson,21,586 -Alex Rodriguez,1,0 -Alex Rodriguez,2,5 -Alex Rodriguez,3,41 -Alex Rodriguez,4,64 -Alex Rodriguez,5,106 -Alex Rodriguez,6,148 -Alex Rodriguez,7,189 -Alex Rodriguez,8,241 -Alex Rodriguez,9,298 -Alex Rodriguez,10,345 -Alex Rodriguez,11,381 -Alex Rodriguez,12,429 -Alex Rodriguez,13,464 -Alex Rodriguez,14,518 -Alex Rodriguez,15,553 -Alex Rodriguez,16,583 -Alex Rodriguez,17,613 -Alex Rodriguez,18,629 -Alex Rodriguez,19,647 -Alex Rodriguez,20,654 -Alex Rodriguez,21,687 -Alex Rodriguez,22,696 -Babe Ruth,1,0 -Babe Ruth,2,4 -Babe Ruth,3,7 -Babe Ruth,4,9 -Babe Ruth,5,20 -Babe Ruth,6,49 -Babe Ruth,7,103 -Babe Ruth,8,162 -Babe Ruth,9,197 -Babe Ruth,10,238 -Babe Ruth,11,284 -Babe Ruth,12,309 -Babe Ruth,13,356 -Babe Ruth,14,416 -Babe Ruth,15,470 -Babe Ruth,16,516 -Babe Ruth,17,565 -Babe Ruth,18,611 -Babe Ruth,19,652 -Babe Ruth,20,686 -Babe Ruth,21,708 -Babe Ruth,22,714 -Mike Schmidt,1,1 -Mike Schmidt,2,19 -Mike Schmidt,3,55 -Mike Schmidt,4,93 -Mike Schmidt,5,131 -Mike Schmidt,6,169 -Mike Schmidt,7,190 -Mike Schmidt,8,235 -Mike Schmidt,9,283 -Mike Schmidt,10,314 -Mike Schmidt,11,349 -Mike Schmidt,12,389 -Mike Schmidt,13,425 -Mike Schmidt,14,458 -Mike Schmidt,15,495 -Mike Schmidt,16,530 -Mike Schmidt,17,542 -Mike Schmidt,18,548 -Sammy Sosa,1,4 -Sammy Sosa,2,19 -Sammy Sosa,3,29 -Sammy Sosa,4,37 -Sammy Sosa,5,70 -Sammy Sosa,6,95 -Sammy Sosa,7,131 -Sammy Sosa,8,171 -Sammy Sosa,9,207 -Sammy Sosa,10,273 -Sammy Sosa,11,336 -Sammy Sosa,12,386 -Sammy Sosa,13,450 -Sammy Sosa,14,499 -Sammy Sosa,15,539 -Sammy Sosa,16,574 -Sammy Sosa,17,588 -Sammy Sosa,18,609 -Jim Thome,1,1 -Jim Thome,2,3 -Jim Thome,3,10 -Jim Thome,4,30 -Jim Thome,5,55 -Jim Thome,6,93 -Jim Thome,7,133 -Jim Thome,8,163 -Jim Thome,9,196 -Jim Thome,10,233 -Jim Thome,11,282 -Jim Thome,12,334 -Jim Thome,13,381 -Jim Thome,14,423 -Jim Thome,15,430 -Jim Thome,16,472 -Jim Thome,17,507 -Jim Thome,18,541 -Jim Thome,19,564 -Jim Thome,20,589 -Jim Thome,21,604 -Jim Thome,22,612 diff --git a/data/covid19.csv b/data/covid19.csv deleted file mode 100644 index d4a6fb8..0000000 --- a/data/covid19.csv +++ /dev/null @@ -1,58 +0,0 @@ -date,Belgium,Brazil,Canada,China,France,Germany,India,Indonesia,Iran,Ireland,Italy,Mexico,Netherlands,Portugal,Spain,Sweden,Switzerland,Turkey,USA,United Kingdom -2020-02-26,,,,2717.0,2.0,,,,19.0,,12.0,,,,,,,,, -2020-02-27,,,,2746.0,2.0,,,,26.0,,17.0,,,,,,,,, -2020-02-28,,,,2790.0,2.0,,,,34.0,,21.0,,,,,,,,, -2020-02-29,,,,2837.0,2.0,,,,43.0,,29.0,,,,,,,,1.0, -2020-03-01,,,,2872.0,2.0,,,,54.0,,34.0,,,,,,,,1.0, -2020-03-02,,,,2914.0,3.0,,,,66.0,,52.0,,,,,,,,6.0, -2020-03-03,,,,2947.0,4.0,,,,77.0,,79.0,,,,1.0,,,,7.0, -2020-03-04,,,,2983.0,4.0,,,,92.0,,107.0,,,,2.0,,,,11.0, -2020-03-05,,,,3015.0,6.0,,,,107.0,,148.0,,,,3.0,,1.0,,12.0,1.0 -2020-03-06,,,,3044.0,9.0,,,,124.0,,197.0,,1.0,,5.0,,1.0,,14.0,2.0 -2020-03-07,,,,3072.0,11.0,,,,145.0,,233.0,,1.0,,10.0,,1.0,,17.0,2.0 -2020-03-08,,,,3100.0,19.0,,,,194.0,,366.0,,3.0,,17.0,,2.0,,21.0,3.0 -2020-03-09,,,1.0,3123.0,19.0,2.0,,,237.0,,463.0,,3.0,,28.0,,2.0,,22.0,4.0 -2020-03-10,,,1.0,3139.0,33.0,2.0,,,291.0,,631.0,,4.0,,35.0,,3.0,,28.0,6.0 -2020-03-11,3.0,,1.0,3161.0,48.0,3.0,1.0,1.0,354.0,1.0,827.0,,5.0,,54.0,1.0,4.0,,32.0,8.0 -2020-03-12,3.0,,1.0,3172.0,48.0,3.0,1.0,1.0,429.0,1.0,1000.0,,5.0,,55.0,1.0,4.0,,40.0,8.0 -2020-03-13,3.0,,1.0,3180.0,79.0,7.0,2.0,4.0,514.0,1.0,1266.0,,10.0,,133.0,1.0,11.0,,48.0,8.0 -2020-03-14,4.0,,1.0,3193.0,91.0,9.0,2.0,5.0,611.0,2.0,1441.0,,12.0,,195.0,2.0,13.0,,54.0,21.0 -2020-03-15,4.0,,1.0,3203.0,91.0,11.0,2.0,5.0,724.0,2.0,1809.0,,20.0,,289.0,3.0,14.0,,60.0,21.0 -2020-03-16,5.0,,4.0,3217.0,149.0,17.0,2.0,5.0,853.0,2.0,2158.0,,24.0,,342.0,6.0,14.0,,84.0,56.0 -2020-03-17,10.0,1.0,5.0,3230.0,149.0,24.0,3.0,5.0,988.0,2.0,2503.0,,43.0,1.0,533.0,7.0,27.0,1.0,107.0,56.0 -2020-03-18,14.0,3.0,8.0,3241.0,149.0,28.0,3.0,19.0,1135.0,2.0,2978.0,,58.0,2.0,623.0,10.0,28.0,1.0,143.0,72.0 -2020-03-19,21.0,6.0,9.0,3249.0,244.0,44.0,4.0,25.0,1284.0,3.0,3405.0,1.0,77.0,3.0,830.0,11.0,41.0,3.0,209.0,138.0 -2020-03-20,37.0,11.0,12.0,3253.0,451.0,67.0,5.0,32.0,1433.0,3.0,4032.0,1.0,107.0,6.0,1043.0,16.0,54.0,4.0,260.0,178.0 -2020-03-21,67.0,15.0,19.0,3259.0,563.0,84.0,6.0,38.0,1556.0,3.0,4825.0,2.0,137.0,12.0,1375.0,20.0,75.0,9.0,320.0,234.0 -2020-03-22,75.0,25.0,21.0,3274.0,676.0,94.0,7.0,48.0,1685.0,4.0,5476.0,2.0,180.0,14.0,1772.0,21.0,98.0,30.0,427.0,282.0 -2020-03-23,88.0,34.0,25.0,3274.0,862.0,123.0,10.0,49.0,1812.0,6.0,6077.0,3.0,214.0,23.0,2311.0,25.0,120.0,37.0,552.0,336.0 -2020-03-24,122.0,46.0,26.0,3281.0,1102.0,157.0,10.0,55.0,1934.0,7.0,6820.0,4.0,277.0,33.0,2808.0,36.0,122.0,44.0,706.0,423.0 -2020-03-25,178.0,59.0,30.0,3285.0,1333.0,206.0,12.0,58.0,2077.0,9.0,7503.0,5.0,357.0,43.0,3647.0,62.0,153.0,59.0,943.0,466.0 -2020-03-26,220.0,77.0,38.0,3291.0,1698.0,267.0,20.0,78.0,2234.0,19.0,8215.0,6.0,435.0,60.0,4365.0,77.0,191.0,75.0,1210.0,580.0 -2020-03-27,289.0,92.0,54.0,3296.0,1997.0,342.0,20.0,87.0,2378.0,22.0,9134.0,8.0,547.0,76.0,5138.0,105.0,231.0,92.0,1582.0,761.0 -2020-03-28,353.0,111.0,61.0,3299.0,2317.0,433.0,24.0,102.0,2517.0,36.0,10023.0,12.0,640.0,100.0,5982.0,105.0,264.0,108.0,2182.0,1021.0 -2020-03-29,431.0,136.0,64.0,3304.0,2611.0,533.0,27.0,114.0,2640.0,46.0,10779.0,16.0,772.0,119.0,6803.0,110.0,300.0,131.0,2566.0,1231.0 -2020-03-30,513.0,159.0,80.0,3308.0,3030.0,645.0,32.0,122.0,2757.0,54.0,11591.0,20.0,865.0,140.0,7716.0,146.0,359.0,168.0,3112.0,1411.0 -2020-03-31,705.0,201.0,101.0,3309.0,3532.0,775.0,35.0,136.0,2898.0,71.0,12428.0,28.0,1040.0,160.0,8464.0,180.0,433.0,214.0,4039.0,1793.0 -2020-04-01,828.0,240.0,109.0,3316.0,4414.0,920.0,58.0,157.0,3036.0,85.0,13155.0,29.0,1175.0,187.0,9387.0,239.0,488.0,277.0,4995.0,2357.0 -2020-04-02,1011.0,324.0,139.0,3322.0,5398.0,1107.0,72.0,170.0,3160.0,98.0,13915.0,37.0,1341.0,209.0,10348.0,308.0,536.0,356.0,6294.0,2926.0 -2020-04-03,1143.0,359.0,179.0,3326.0,6520.0,1275.0,72.0,181.0,3294.0,120.0,14681.0,50.0,1490.0,246.0,11198.0,358.0,591.0,425.0,7418.0,3611.0 -2020-04-04,1283.0,445.0,218.0,3330.0,7574.0,1444.0,86.0,191.0,3452.0,137.0,15362.0,60.0,1656.0,266.0,11947.0,373.0,666.0,501.0,8387.0,4320.0 -2020-04-05,1447.0,486.0,259.0,3333.0,8093.0,1584.0,99.0,198.0,3603.0,158.0,15887.0,79.0,1771.0,295.0,12641.0,401.0,715.0,574.0,9489.0,4943.0 -2020-04-06,1632.0,564.0,339.0,3335.0,8926.0,1810.0,136.0,209.0,3739.0,174.0,16523.0,94.0,1874.0,311.0,13341.0,477.0,765.0,649.0,10783.0,5385.0 -2020-04-07,2035.0,686.0,375.0,3335.0,10343.0,2016.0,150.0,221.0,3872.0,210.0,17127.0,125.0,2108.0,345.0,14045.0,591.0,821.0,725.0,12798.0,6171.0 -2020-04-08,2240.0,819.0,407.0,3337.0,10887.0,2349.0,178.0,240.0,3993.0,235.0,17669.0,141.0,2255.0,380.0,14792.0,687.0,895.0,812.0,14704.0,7111.0 -2020-04-09,2523.0,950.0,503.0,3339.0,12228.0,2607.0,226.0,280.0,4110.0,263.0,18279.0,174.0,2403.0,409.0,15447.0,793.0,948.0,908.0,16553.0,7993.0 -2020-04-10,3019.0,1057.0,557.0,3340.0,13215.0,2767.0,246.0,306.0,4232.0,287.0,18849.0,194.0,2520.0,435.0,16081.0,870.0,1002.0,1006.0,18595.0,8974.0 -2020-04-11,3346.0,1124.0,654.0,3343.0,13851.0,2894.0,288.0,327.0,4357.0,320.0,19468.0,233.0,2653.0,470.0,16606.0,887.0,1036.0,1101.0,20471.0,9892.0 -2020-04-12,3600.0,1223.0,714.0,3343.0,14412.0,3022.0,331.0,373.0,4474.0,334.0,19899.0,273.0,2747.0,504.0,17209.0,899.0,1106.0,1198.0,22032.0,10629.0 -2020-04-13,3903.0,1328.0,779.0,3345.0,14986.0,3194.0,358.0,399.0,4585.0,365.0,20465.0,296.0,2833.0,535.0,17756.0,919.0,1138.0,1296.0,23546.0,11347.0 -2020-04-14,4157.0,1532.0,899.0,3345.0,15748.0,3294.0,393.0,459.0,4683.0,406.0,21067.0,332.0,2955.0,567.0,18056.0,1033.0,1174.0,1403.0,25854.0,12129.0 -2020-04-15,4440.0,1736.0,1006.0,3346.0,17188.0,3804.0,405.0,469.0,4777.0,444.0,21645.0,406.0,3145.0,599.0,18708.0,1203.0,1239.0,1518.0,28341.0,12894.0 -2020-04-16,4857.0,1924.0,1257.0,3346.0,17941.0,4052.0,448.0,496.0,4869.0,486.0,22170.0,449.0,3327.0,629.0,19315.0,1333.0,1281.0,1643.0,32933.0,13759.0 -2020-04-17,5163.0,2141.0,1354.0,4636.0,18703.0,4352.0,486.0,520.0,4958.0,530.0,22745.0,486.0,3471.0,657.0,20002.0,1400.0,1327.0,1769.0,36790.0,14607.0 -2020-04-18,5453.0,2354.0,1399.0,4636.0,19345.0,4459.0,521.0,535.0,5031.0,571.0,23227.0,546.0,3613.0,687.0,20043.0,1511.0,1368.0,1890.0,38671.0,15498.0 -2020-04-19,5683.0,2462.0,1563.0,4636.0,19744.0,4586.0,559.0,582.0,5118.0,610.0,23660.0,650.0,3697.0,714.0,20453.0,1540.0,1393.0,2017.0,40664.0,16095.0 -2020-04-20,5828.0,2587.0,1725.0,4636.0,20292.0,4862.0,592.0,590.0,5209.0,687.0,24114.0,686.0,3764.0,735.0,20852.0,1580.0,1429.0,2140.0,42097.0,16550.0 -2020-04-21,5998.0,2741.0,1908.0,4636.0,20829.0,5033.0,645.0,616.0,5297.0,730.0,24648.0,712.0,3929.0,762.0,21282.0,1765.0,1478.0,2259.0,44447.0,17378.0 -2020-04-22,6262.0,2906.0,2075.0,4636.0,21373.0,5279.0,681.0,635.0,5391.0,769.0,25085.0,857.0,4068.0,785.0,21717.0,1937.0,1509.0,2376.0,46628.0,18151.0 diff --git a/data/covid19_tutorial.csv b/data/covid19_tutorial.csv deleted file mode 100644 index 2792c04..0000000 --- a/data/covid19_tutorial.csv +++ /dev/null @@ -1,11 +0,0 @@ -date,Belgium,China,France,Germany,Iran,Italy,Netherlands,Spain,USA,United Kingdom -2020-04-03,1143,3326,6520,1275,3294,14681,1490,11198,7418,3611 -2020-04-04,1283,3330,7574,1444,3452,15362,1656,11947,8387,4320 -2020-04-05,1447,3333,8093,1584,3603,15887,1771,12641,9489,4943 -2020-04-06,1632,3335,8926,1810,3739,16523,1874,13341,10783,5385 -2020-04-07,2035,3335,10343,2016,3872,17127,2108,14045,12798,6171 -2020-04-08,2240,3337,10887,2349,3993,17669,2255,14792,14704,7111 -2020-04-09,2523,3339,12228,2607,4110,18279,2403,15447,16553,7993 -2020-04-10,3019,3340,13215,2767,4232,18849,2520,16081,18595,8974 -2020-04-11,3346,3343,13851,2894,4357,19468,2653,16606,20471,9892 -2020-04-12,3600,3343,14412,3022,4474,19899,2747,17209,22032,10629 diff --git a/data/urban_pop.csv b/data/urban_pop.csv deleted file mode 100644 index be12777..0000000 --- a/data/urban_pop.csv +++ /dev/null @@ -1,44 +0,0 @@ -year,United States,India,China,Ethiopia,Poland,Malaysia,Peru,Venezuela,Iraq,Saudi Arabia,Canada,Algeria,Ukraine,Vietnam,Thailand,"Congo, Dem. Rep.",Spain,South Africa,Colombia,Argentina,Egypt,South Korea,Italy,Philippines,France,United Kingdom,Bangladesh,Iran,Turkey,Germany,Pakistan,Nigeria,Mexico,Russia,Japan,Indonesia,Brazil -1976,160611122,138219074,162497601,3194879,19215135,4802814,9834645,10382196,7530612,4673719,17705309,6919237,28966085,9399461,10568872,6141742,25379947,12445371,15011687,21370520,17210387,17823527,36687131,15245564,39578989,43757644,7667521,15742290,16914583,56885943,18365687,13177979,38883279,90810675,85642808,26596457,67790415 -1977,162256678,143699557,165293316,3300643,19625330,5038232,10197056,10778965,7901451,5041250,17923214,7196331,29452016,9652431,11092595,6381644,25880544,12771480,15524763,21797026,17668393,18743336,36955192,15826569,39798460,43833733,8543815,16521005,17474315,56801863,19175026,13868037,40371908,92479950,86538157,28001978,70478354 -1978,164005080,149379782,171153535,3406129,20007316,5284698,10567468,11185526,8253727,5441027,18112108,7565661,29928920,9911702,11628473,6630163,26368356,13105135,16052408,22227673,18089504,19679806,37198851,16426578,40001620,43925435,9528585,17336704,18048189,56796181,20032626,14598364,41879098,94157479,87391419,29468690,73245834 -1979,165847531,155285824,180399661,3522584,20341874,5539880,10945723,11600322,8598800,5885282,18301934,7956090,30386569,10181044,12176748,6882719,26838008,13454231,16593237,22668000,18530889,20636698,37418639,17048162,40205371,44054299,10622254,18227951,18640066,56865826,20941767,15355488,43407693,95659612,88197927,30996679,76091693 -1980,167551171,161444128,189947471,3658252,20663601,5801267,11331194,12022351,8945814,6382806,18549289,8369497,30825447,10447627,12692095,7135884,27289444,13828615,17145845,23122595,18994489,21623805,37607540,17738316,40423470,44195960,11827261,19206467,19252680,57028530,21906732,16131172,44952217,96960865,88958689,32591870,79015954 -1981,169552427,167521704,199949784,3817958,20985955,6050366,11723239,12450233,9294818,6937865,18791654,8805955,31287683,10720898,13071774,7389309,27669147,14253248,17710021,23609667,19480106,22617087,37764025,18687449,40659231,44271630,12920085,20274421,20329814,57229147,22897114,17103116,46412878,98228786,89733659,34436558,82013626 -1982,171528659,173152676,210823843,4000296,21314754,6305685,12089571,12875246,9646517,7546375,19057229,9265778,31693551,11006067,13450801,7645260,27925417,14700152,18286697,24118025,19987197,23619800,37819718,19680770,40911627,44228171,13607076,21426582,21630562,57267174,23877291,18109529,47890690,99464693,90474900,36463770,85085296 -1983,173459636,178956141,220472140,4203323,21651242,6571674,12460705,13303646,9998790,8194651,19287381,9746745,32110163,11301138,13832449,7907632,28151118,15162766,18874699,24636888,20516521,24621925,37822134,20717792,41177471,44215089,14326358,22654500,22977503,57114118,24901258,19156448,49383429,100677781,91224787,38577957,88209014 -1984,175321738,184906540,230206255,4422527,21984900,6854613,12837778,13741349,10349519,8862080,19511294,10246073,32533314,11603770,14220724,8182628,28357570,15630401,19472129,25163825,21068787,25577374,37819273,21799606,41450438,44257473,15083858,23944608,24362121,56792461,25962081,20257934,50884710,102058393,91937389,40774954,91357900 -1985,177239105,190975975,240414890,4655890,22299554,7158816,13220933,14189017,10697257,9530555,19731489,10759943,32933625,11912008,14616958,8520035,28549379,16134214,20077488,25695319,21643302,26473134,37818886,22923393,41726184,44329755,15880101,25281030,25769767,56485448,27052677,21421320,52390613,103466989,92632808,43042272,94505178 -1986,179244877,197165614,251325056,4901173,22589785,7487770,13610395,14647328,11040738,10193888,19967235,11287827,33344880,12225169,15025684,8876843,28723937,16716155,20656600,26230730,22241759,27480866,37809627,24093004,42005647,44404206,16718788,26666054,27034322,56438249,28172326,22654337,53899557,104825013,93348378,45381922,97647144 -1987,181215212,203469688,262976051,5160078,22855463,7839689,14005309,15114933,11382713,10774882,20237468,11821049,33766182,12541644,15443627,9253676,28887112,17299431,21228791,26769637,22812398,28537079,37802166,25307752,42289365,44470325,17598710,28011702,28238882,56695484,29321589,23956989,55410753,106169956,93963675,47793464,100778354 -1988,183232441,209894838,275121076,5434867,23089202,8210275,14404448,15589603,11640586,11342799,20506939,12346640,34209429,12862589,15862003,9660136,29036437,17891635,21808613,27309085,23358966,29585374,37809110,26565345,42572024,44540723,18516964,29328931,29455664,57044790,30497993,25327851,56925349,107471421,94519909,50281090,103903008 -1989,185333919,216442440,287504237,5728511,23241946,8591294,14805506,16067828,11877599,11895419,20883649,12878973,34541910,13237507,16267069,10107028,29169746,18505772,22398271,27844463,23893893,30626132,37826147,27860539,42846787,44628280,19464440,30587388,30682120,57469536,31695621,26761923,58445699,108424260,95061557,52840795,107023058 -1990,187966119,223096279,300165618,6043927,23350476,8977771,15207438,16547195,12142167,12432320,21206427,13416507,34641542,13772504,16641681,10602701,29286916,19149881,23000000,28373007,24406147,31656393,37846480,29082060,43127028,44733264,20439396,31751090,31923300,58079842,32914428,28259055,59951345,108837430,95542280,55483475,110146163 -1991,191509147,229752408,314301034,6383315,23450653,9366643,15608008,17014346,12437110,12952377,21482271,13958197,34734234,14324149,16936803,11155614,29430524,19822817,23613619,28887229,24890671,32459655,37861339,29760929,43467991,44855736,21391215,32799183,32891192,58625381,34148626,29472185,61411745,109073667,96005316,58355038,113265899 -1992,195199459,236274335,328521540,6744717,23539562,9846036,16007183,17476497,12759904,13454748,21813814,14502589,34854630,14889784,17206294,11762423,29607126,20511177,24238652,29352243,25351104,33169705,37907512,30439167,43785894,45011752,22255441,33888647,33738148,59146205,35400161,30726608,62876086,109115423,96414127,61396542,116379447 -1993,198806845,242896345,342961393,7125617,23616843,10348234,16406525,17938345,13107820,13888412,22130869,15044498,34894325,15462867,17462829,12400106,29793326,21212379,24870590,29809452,25795989,33872973,37964793,31119331,44077099,45154426,23136115,34949749,34589980,59647492,36682088,32024149,64340297,108985461,96821759,64522965,119489196 -1994,202278113,249629427,357836540,7519515,23684074,10868160,16820251,18400682,13475501,14285427,22450573,15579364,34741407,16036816,17724400,13037939,29967941,21906214,25506165,30260590,26238204,34575766,38006634,31802962,44342923,45304828,24044693,35978707,35453793,60028206,38012967,33368626,65800649,108843023,97320876,67741187,122608542 -1995,205718394,256470883,373035157,7888014,23733222,11409139,17240497,18863803,13858715,14663134,22760570,16103497,34487999,16604653,18004312,13652804,30133075,22576687,26142216,30705908,26687693,35280305,38041344,32491471,44604027,45459651,24983813,37010603,36333541,60378049,39405594,34764761,67251519,108866238,97862490,71046004,125743641 -1996,209146726,263440887,388593258,8247227,23768665,11973524,17668537,19326875,14255733,15019607,23081461,16615709,34203211,17163390,18309040,14233459,30291556,23218617,26777679,31145811,27145811,35810625,38086153,33183963,44863823,45610451,25958281,38054098,37230469,60725922,40868934,36216363,68621427,108700578,98272808,74433222,128896593 -1997,212694273,270523260,404485562,8610539,23801620,12557524,18100961,19788904,14665741,15360171,23428320,17115300,33912723,17713643,18632440,14788167,30451227,23836117,27410868,31579645,27681745,36259672,38140443,33879027,45123550,45762480,26961627,39051703,38142785,60986289,42394458,37721269,69944968,108515107,98667335,77897525,132175402 -1998,216206090,277707327,420606126,8981735,23827143,13157335,18529226,20251502,15123544,15704580,23739358,17606301,33630036,18256423,18965132,15338240,30610090,24431488,28043543,32009566,28270163,36633453,38185563,34576876,45390693,45931122,27993765,40038693,39068844,61167004,43938667,39284672,71260342,108329743,99095072,81452538,135456370 -1999,219721677,284978106,436766058,9363839,23842562,13764926,18940925,20715860,15606189,16078075,24048329,18103945,33333798,18823973,19293244,15915279,30767125,25011815,28676311,32438320,28862915,37006183,38226137,35277843,45743988,46119137,29046503,41030621,40002835,61376500,45445310,40910972,72568684,107987645,99434460,85098300,138709641 -2000,223069137,292322757,452999147,9761536,23611695,14375105,19326872,21182664,16094906,16499665,24388404,18600197,33019123,19477364,19758316,16544508,30937864,25582579,29309135,32867357,29457843,37428328,38277624,35981496,46214923,46319551,30114488,42026541,40942334,61629857,46947759,42603693,73899942,107528575,99760751,88840036,141915773 -2001,225792302,300118524,471767321,10174157,23622394,14918252,19683539,21651926,16594707,16978440,24757782,19094843,32707281,20134757,20680738,17234266,31186430,26143328,29941986,33297967,30055505,37867709,38333314,36689358,46709571,46557334,31346174,43031116,41943212,61902439,48435634,44726802,75268749,107067618,101706485,91738482,144508698 -2002,228400290,308796507,491993700,10604081,23621395,15458510,20014065,22057235,17104294,17510539,25052940,19591211,32432088,20800243,21613066,17981229,31708814,26720456,30573543,33728934,30659220,38258247,38447500,37399541,47206863,46930583,32796275,44050010,42979004,62174878,49919690,46947855,76634718,106568907,104055019,94698443,147005321 -2003,230876596,317584393,512473984,11049316,23563051,15999895,20323604,22460389,17607000,18084339,25304780,20095408,32238838,21474148,22554369,18783707,32390830,27305501,31200433,34159485,31267885,38626122,38686985,38104244,47699501,47323791,34276157,45078311,44016864,62376854,51408755,49272800,78013778,106132766,106256267,97720468,149452654 -2004,233532722,326495067,533257098,11510093,23506503,16548747,20619818,22858285,18080764,18680566,25566897,20616005,32075858,22163653,23508150,19635486,33059302,27898739,31817837,34588886,31879899,38947802,39006818,38793193,48209404,47767769,35772637,46107032,45048098,62529997,52922901,51708640,79428213,105771150,108136910,100811250,151843988 -2005,236200507,335503762,554367818,11986371,23453429,17108405,20909083,23248394,18513378,19286107,25834340,21159469,31932581,22870388,24472850,20534304,33727737,28506195,32422505,35015695,32495526,39195731,39267369,39459729,48730233,48269624,37274029,47130046,46065713,62660267,54474508,54260116,80890450,105433013,109856670,103961908,154176524 -2006,238999326,344622641,575118254,12478999,23396235,17681869,21194852,23622801,18889524,19893608,26126316,21729732,31801166,23598140,25451682,21483246,34408810,29131012,33015422,35439470,33111793,39490771,39454178,40099208,49228316,48798541,38777278,48145863,47064036,62753557,56069495,56934076,82408287,105152847,111383848,107178769,156447985 -2007,241795278,353850625,595670841,13001478,23340838,18266045,21477303,23979532,19223314,20507062,26441461,22327433,31694727,24348000,26439736,22487132,35159317,29774433,33597410,35861110,33700835,39740941,39722857,40715257,49690034,49351705,40283010,49125150,48048353,62833410,57704173,59734515,83973950,105037426,112827761,110459097,158660052 -2008,244607104,363154577,616481190,13689470,23300939,18854125,21722213,24328099,19565443,21137735,26789863,22955890,31605915,25120981,27438708,23545867,35833174,30442138,34166611,36284569,34289703,40093884,40056298,41319488,50127513,49913475,41802031,50093529,49047262,62875807,59373384,62665438,85573769,105055515,114107975,113814309,160823508 -2009,247276259,372465917,637407288,14413055,23274004,19435329,21951808,24683266,19985687,21801430,27158023,23612219,31547432,25920396,28447159,24661566,36260460,31137754,34720224,36714245,34919606,40351067,40308358,41929228,50547198,50463084,43352798,51080202,50096864,62877220,61070625,65723902,87182005,105149982,115228215,117243827,162949977 -2010,249845296,381763166,658498663,15178365,23165018,20002882,22185851,25050752,20552598,22508632,27522537,24299173,31465465,26757120,29469051,25833935,36535850,31866171,35257426,37055902,35603056,40602657,40502481,42597021,50961407,51030310,44954427,52095517,51225589,62940432,62793242,68917190,88781439,105261473,116302928,120709130,165055094 -2011,252186596,391040303,678933504,15986316,23134846,20516662,22421443,25452964,21282801,23264870,27847821,25016303,31395063,27621281,30179366,27065209,36773882,32630538,35770189,37543830,36347578,40909592,40641670,43505397,51373800,51600211,46610737,53140089,52440387,61940177,64539555,72230098,90370891,105407907,116416235,124016544,167158525 -2012,254576561,400417728,699187267,16839218,23086831,21009012,22662393,25875071,22141872,24058860,28166078,25763106,31359984,28514086,30828051,28355103,36904876,33429132,36262940,38027774,37114895,41089082,40894259,44437841,51791144,52130345,48311928,54203628,53730762,62064608,66312625,75664328,91948801,105669949,116331281,127396459,169240750 -2013,256899730,409909187,719587859,17717910,23025350,21491648,22922695,26249155,23075649,24865453,28479640,26536378,31330962,29430443,31477989,29704531,36891840,34249974,36761204,38509756,37919402,41240244,41548775,45385009,52228061,52650595,50048763,55292621,55071747,62242278,68114463,79214937,93515787,105998510,116262976,130826016,171300683 -2014,259361210,419568459,740239259,18635946,22960228,21974918,23221633,26482983,24005089,25648738,28781576,27332602,31223156,30371288,32127193,31115109,36890017,35079618,37300597,38990109,38737018,41463573,42109853,46329521,52647802,53209683,51818338,56418308,56438761,62510392,69956952,82878551,95072126,106354643,116208079,134287151,173346772 -2015,261865944,429428653,761027100,19590313,22897449,22464989,23571246,26518336,24872481,26382755,29011826,28146511,31183824,31333193,32772699,32586918,36971015,35905874,37904385,39467043,39551544,41645542,42247229,47262079,53009026,53802927,53608403,57580319,57806283,63062064,71845558,86652532,96615320,106703732,116182717,137751865,175375436 -2016,264366216,439498772,782199374,20581872,22849639,22964507,23979736,26313884,25661856,27057429,29357013,28977628,31122512,32314724,33415230,34121207,37112875,36724030,38589139,39940546,40359123,41774264,42351339,48177810,53321626,54382825,55420910,58781895,59175037,63592936,73782310,90531047,98145001,107050095,116145370,141210511,177386818 -2017,266676634,449789369,803554542,21609845,22824769,23467810,24438508,25917344,26391343,27678169,29727992,29821745,31043768,33310316,34051250,35717778,37311863,37534797,39338952,40410674,41185809,41861498,42462869,49096983,53612472,54923317,57254681,60016579,60537696,63861626,75761710,94518555,99655905,107349518,116053379,144652795,179379301 -2018,268720071,460295677,823827650,22678295,22806875,23973075,24921870,25465822,27085311,28255384,30169097,30670086,30946607,34317154,34678853,37376673,37587449,38339668,40105215,40877099,42030812,42038247,42559879,50027217,53879064,55426598,59107944,61266765,61857510,64096118,77810763,98611179,101149488,107539347,115920900,148084795,181335507 diff --git a/demo.gif b/demo.gif new file mode 100644 index 0000000..61d9469 Binary files /dev/null and b/demo.gif differ diff --git a/docs/css/style.css b/docs/css/style.css deleted file mode 100644 index c87d44a..0000000 --- a/docs/css/style.css +++ /dev/null @@ -1,42 +0,0 @@ -table { - background-color: transparent; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - margin-left:0; - margin-right:0; - border:none; - border-collapse: collapse; - border-spacing:0; - color:black; - font-size:13px; - table-layout:fixed; - } -thead { - border-bottom:1px solid black;vertical-align:bottom; - } -tr, th, td { - text-align:right; - vertical-align: middle; - padding:0.5em 0.5em; - line-height:normal; - white-space:normal; - max-width:none; - border:none; - } -th { - font-weight:bold; - text-align:left; - } -tbody tr:nth-child(odd){ - background:#f5f5f5; - } - :link{ - text-decoration:underline; -} - -.vid { - display: flex; - justify-content: center; -} -.vid video { - width: 85%; -} \ No newline at end of file diff --git a/docs/data_preparation.md b/docs/data_preparation.md deleted file mode 100644 index 1e9c7b1..0000000 --- a/docs/data_preparation.md +++ /dev/null @@ -1,96 +0,0 @@ -# Data Preparation - -bar_chart_race exposes two functions, `prepare_wide_data` and `prepare_long_data` to transform pandas DataFrames to the correct form. - -## Wide data - - To show how the `prepare_wide_data` function works, we'll read in the last three rows from the `covid19_tutorial` dataset. - -```python -df = bcr.load_dataset('covid19_tutorial').tail(3) -df -``` - -{% include 'html/data_preparation_1.html' %} - -This format of data is sometimes known as 'wide' data since each column contains data that all represents the same thing (deaths). Each new country would add an additional column to the DataFrame, making it wider. This is the type of data that the `bar_chart_race` function requires. - -The `prepare_wide_data` function is what `bar_chart_race` calls internally, so it isn't necessary to use directly. However, it is available so that you can view and understand how the data gets prepared. To transition the bars smoothly from one time period to the next, both the length of the bars and position are changed linearly. Two DataFrames of the same shape are returned - one for the values and the other for the ranks. - -```python -df_values, df_ranks = bcr.prepare_wide_data(df, steps_per_period=4, - orientation='h', sort='desc') -``` - -Below, we have the `df_values` DataFrame containing the length of each bar for each frame. A total of four rows now exist for each period. - -{% include 'html/data_preparation_2.html' %} - -The `df_ranks` DataFrame contains the numerical ranking of each country and is used for the position of the bar along the y-axis (or x-axis when veritcal). Notice that there are two sets of bars that switch places. - -{% include 'html/data_preparation_3.html' %} - -### Don't use before animation - -There is no need to use this function before making the animation if you already have wide data. Pass the `bar_chart_race` function your original data. - -## Long data - -'Long' data is a format for data where all values of the same kind are stored in a single column. Take a look at the baseball data below, which contains the cumulative number of home runs each of the top 20 home run hitters accumulated by year. - -```python -df_baseball = bcr.load_dataset('baseball') -df_baseball -``` - -{% include 'html/data_preparation_4.html' %} - -Name, year, and home runs are each in a single column, contrasting with the wide data, where each column had the same type of data. Long data must be converted to wide data by pivoting categorical column and placing the period in the index. The `prepare_long_data` provides this functionality. It simply uses the pandas `pivot_table` method to pivot (and potentially aggregate) the data before passing it to `prepare_wide_data`. The same two DataFrames are returned. - -```python -df_values, df_ranks = bcr.prepare_long_data(df_baseball, index='year', columns='name', - values='hr', steps_per_period=5) -df_values.head(16) -``` - -The linearly interpolated values for the first three seasons of each player: - -{% include 'html/data_preparation_5.html' %} - -The rankings change substantially during this time period. - -```python -df_ranks.head(16) -``` - -{% include 'html/data_preparation_6.html' %} - -### Usage before animation - -If you wish to use this function before an animation, set `steps_per_period` to 1. - -```python -df_values, df_ranks = bcr.prepare_long_data(df_baseball, index='year', columns='name', - values='hr', steps_per_period=1, - orientation='h', sort='desc') - -def period_summary(values, ranks): - top2 = values.nlargest(2) - leader = top2.index[0] - lead = top2.iloc[0] - top2.iloc[1] - s = f'{leader} by {lead:.0f}' - return {'s': s, 'x': .95, 'y': .07, 'ha': 'right', 'size': 8} - -bcr.bar_chart_race(df_values, period_length=1000, - fixed_max=True, fixed_order=True, n_bars=10, - figsize=(5, 3), period_fmt='Season {x:,.0f}', - title='Top 10 Home Run Hitters by Season Played') -``` - -{% macro video(name) %} -
- -
-{% endmacro %} - -
{{ video('prepare_long') }}
\ No newline at end of file diff --git a/docs/images/bcr_notebook.png b/docs/images/bcr_notebook.png deleted file mode 100644 index 0c2d3bb..0000000 Binary files a/docs/images/bcr_notebook.png and /dev/null differ diff --git a/docs/images/covid19_horiz.gif b/docs/images/covid19_horiz.gif deleted file mode 100644 index ff7d1b8..0000000 Binary files a/docs/images/covid19_horiz.gif and /dev/null differ diff --git a/docs/images/prepare_long.png b/docs/images/prepare_long.png deleted file mode 100644 index c8c93b1..0000000 Binary files a/docs/images/prepare_long.png and /dev/null differ diff --git a/docs/images/wide_data.png b/docs/images/wide_data.png deleted file mode 100644 index ca23b71..0000000 Binary files a/docs/images/wide_data.png and /dev/null differ diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 2bebb6a..0000000 --- a/docs/index.md +++ /dev/null @@ -1,112 +0,0 @@ -# Bar Chart Race - -[![](https://img.shields.io/pypi/v/bar_chart_race)](https://pypi.org/project/bar_chart_race) -[![PyPI - License](https://img.shields.io/pypi/l/bar_chart_race)](LICENSE) - -Make animated bar and line chart races in Python with matplotlib or plotly. - -![](images/covid19_horiz.gif) - -{% include 'html/plotly1.html' %} - -## Installation - -Install with either: - -* `pip install bar_chart_race` -* `conda install -c conda-forge bar_chart_race` - -## Quickstart - -Begin with a pandas DataFrame containing 'wide' data where: - -* Every row represents a single period of time -* Each column holds the value for a particular category -* The index contains the time component (optional) - -The data below is an example of properly formatted data. It shows total deaths from COVID-19 for several countries by date. - -{% include 'html/tutorial_1.html' %} - -### Create bar and line chart races - -There are three core functions available to construct the animations. - -* `bar_chart_race` -* `bar_chart_race_plotly` -* `line_chart_race` - -The above animation was created with the help of matplotlib using the following call to `bar_chart_race`. - -```python -import bar_chart_race -df = bcr.load_dataset('covid19_tutorial') -df.bcr.bar_chart_race( - filename='../docs/images/covid19_horiz.gif', - orientation='h', - sort='desc', - n_bars=8, - fixed_order=False, - fixed_max=True, - steps_per_period=20, - period_length=500, - end_period_pause=0, - interpolate_period=False, - period_label={'x': .98, 'y': .3, 'ha': 'right', 'va': 'center'}, - period_template='%B %d, %Y', - period_summary_func=lambda v, r: {'x': .98, 'y': .2, - 's': f'Total deaths: {v.sum():,.0f}', - 'ha': 'right', 'size': 11}, - perpendicular_bar_func='median', - colors='dark12', - title='COVID-19 Deaths by Country', - bar_size=.95, - bar_textposition='inside', - bar_texttemplate='{x:,.0f}', - bar_label_font=7, - tick_label_font=7, - tick_template='{x:,.0f}', - shared_fontdict=None, - scale='linear', - fig=None, - writer=None, - bar_kwargs={'alpha': .7}, - fig_kwargs={'figsize': (6, 3.5), 'dpi': 144}, - filter_column_colors=False) -``` - -### Save animation to disk or embed into a Jupyter Notebook - -If you are working within a Jupyter Notebook, leave the `filename` as `None` and it will be automatically embedded into a Jupyter Notebook. - -```python -bcr.bar_chart_race(df=df, filename=None) -``` - -### Customization - -There are many options to customize the bar chart race to get the animation you desire. Below, we have an animation where the maximum x-value and order of the bars are set for the entire duration. A custom summary label and perpendicular bar of median is also added. - -```python -def period_summary(values, ranks): - top2 = values.nlargest(2) - leader = top2.index[0] - lead = top2.iloc[0] - top2.iloc[1] - s = f'{leader} by {lead:.0f}' - return {'s': s, 'x': .99, 'y': .03, 'ha': 'right', 'size': 8} - -df_baseball = bcr.load_dataset('baseball').pivot(index='year', - columns='name', - values='hr') -df_baseball.bcr.bar_chart_race( - period_length=1000, - fixed_max=True, - fixed_order=True, - n_bars=10, - period_summary_func=period_summary, - period_label={'x': .99, 'y': .1}, - period_template='Season {x:,.0f}', - title='Top 10 Home Run Hitters by Season Played') -``` - -![](images/baseball_horiz.gif) diff --git a/docs/installation.md b/docs/installation.md deleted file mode 100644 index 7557c9e..0000000 --- a/docs/installation.md +++ /dev/null @@ -1,24 +0,0 @@ -# Installation - -Install from pypi or conda-forge - -* `pip install bar_chart_race` -* `conda install -c conda-forge bar_chart_race` - -## Installing ffmpeg - -In order to save animations as mp4/m4v/mov/etc... files, you must [install ffmpeg][0], which allows for conversion to many different formats of video and audio. For macOS users, installation may be [easier using Homebrew][2]. - -After installation, ensure that `ffmpeg` has been added to your path by going to your command line and entering `ffmepg -version`. - -## Install ImageMagick for animated gifs - -If you desire to create animated gifs, you'll need to [install ImageMagick][1]. Verify that it has been added to your path with `magick -version`. - -## Dependencies - -Bar Chart Race requires that you have both matplotlib and pandas installed. - -[0]: https://www.ffmpeg.org/download.html -[1]: https://imagemagick.org/ -[2]: https://trac.ffmpeg.org/wiki/CompilationGuide/macOS#ffmpegthroughHomebrew \ No newline at end of file diff --git a/docs/tutorial.md b/docs/tutorial.md deleted file mode 100644 index 40dddb1..0000000 --- a/docs/tutorial.md +++ /dev/null @@ -1,316 +0,0 @@ -# Tutorial - -bar_chart_race offers a wide range of inputs to customize the animation. On this page, we'll cover many of the available options. - -## Data format - -The data you choose to animate as a bar chart race must be provided in a specific format. The data must be within a pandas DataFrame containing 'wide' data where: - -* Each row represents a single period of time -* Each column holds the value for a particular category -* The index contains the time component (optional) - -### Example data - -Below, we have an example of properly formatted data that shows total deaths from COVID-19 for several countries by date. Each row represents a single day's worth of data. Each column represents a single country's deaths. The index contains the date. Any pandas DataFrame that conforms to this structure may be used to create a bar chart race. - -{% include 'html/tutorial_1.html' %} - -## Basic bar chart races - -A single main function, `bar_chart_race`, exists to create the animations. Calling it with the defaults returns the animation as an HTML string. The `load_dataset` function is available to load sample DataFrames. If you are working within a Jupyter Notebook, it will automatically be embedded in the output as a video. - -```python -import bar_chart_race -df = bcr.load_dataset('covid19_tutorial') -df.bcr.bar_chart_race() -``` - -{% macro video(name) %} -
- -
-{% endmacro %} - -
{{ video('basic_default') }}
- -### Vertical bars - -By default, bars are horizontal. Use the `orientation` parameter to switch to vertical. - -```python -df.bcr.bar_chart_race(orientation='v') -``` - -
{{ video('basic_vert') }}
- -### Ascending bars - -By default, the bars are plotted in descending order. Change the order by setting `sort` to `'asc'`. - -```python -df.bcr.bar_chart_race(sort='asc') -``` - -
{{ video('basic_asc') }}
- -### Limit the number of bars - -By default, all columns will be plotted. Use `n_bars` to limit the number. When limiting bars, the smallest bar can drop off the plot. - -```python -df.bcr.bar_chart_race(n_bars=6) -``` - -
{{ video('basic_n_bars') }}
- -### Fix the order of the bars - -By default, the bars will be ordered. Set `fixed_order` to `True` or to a specific list of column names to keep the order the same throughout. - -```python -df.bcr.bar_chart_race(fixed_order=['Iran', 'USA', 'Italy', 'Spain', 'Belgium']) -``` - -
{{ video('basic_fixed_order') }}
- -### Fix the maximum value - -By default, the maximum value of the axis moves with the largest bar. Set `fixed_max` to `True` to keep the maximum value equal to the largest overall value for all frames in the animation. - -```python -df.bcr.bar_chart_race(fixed_max=True) -``` - -
{{ video('basic_fixed_max') }}
- -### Change animation smoothness - -By default, 10 frames are used to step from one period to the next. Increase/decrease the smoothness of the animation with `steps_per_period`. - -```python -df.bcr.bar_chart_race(steps_per_period=3) -``` - -
{{ video('basic_steps') }}
- -You may also change the amount of time per period with `period_length`, which is set to 500 milliseconds (half of a second) by default. - -```python -df.bcr.bar_chart_race(steps_per_period=20, period_length=200) -``` - -
{{ video('basic_period_length') }}
- -### Interpolate the period - -By default, the label for each frame changes after the entire period has been plotted. Linearly interpolate the value for the period with `interpolate_period`. Below, every frame increases by 1 / 10 of a day (2 hours and 24 minutes). - -```python -df.bcr.bar_chart_race(interpolate_period=True) -``` - -
{{ video('basic_interpolate') }}
- -## Plot properties - -Many properties of the plot can be set. - -* `figsize` - sets the figure size using matplotlib figure inches (default: `(6, 3.5)`) -* `dpi` - controls the dots per square inch (default: `144`) -* `label_bars` - whether to label the bar values with text (default: `True`) -* `period_label` - dictionary of matplotlib text properties or boolean (default: `True`) -* `title` - title of plot - -```python -df.bcr.bar_chart_race(figsize=(5, 3), dpi=100, label_bars=False, - period_label={'x': .99, 'y': .1, 'ha': 'right', 'color': 'red'}, - title='COVID-19 Deaths by Country') -``` - -
{{ video('basic_props') }}
- -### Label sizes - -Control the size of labels with `bar_label_size`, `tick_label_size`, and `title_size`. - -```python -df.bcr.bar_chart_race(bar_label_size=4, tick_label_size=5, - title='COVID-19 Deaths by Country', title_size='smaller') -``` - -
{{ video('basic_label_size') }}
- -### Setting font properties - -Set font properties for all text objects with `shared_fontdict`. - -```python -df.bcr.bar_chart_race(title='COVID-19 Deaths by Country', - shared_fontdict={'family': 'Helvetica', 'weight': 'bold', - 'color': 'rebeccapurple'}) -``` - -
{{ video('basic_shared_font') }}
-### Customize bar properties - -Set `bar_kwargs` to a dictionary of keyword arguments forwarded to the matploblib `bar` function to control bar properties. - -```python -df.bcr.bar_chart_race(bar_kwargs={'alpha': .2, 'ec': 'black', 'lw': 3}) -``` - -
{{ video('basic_bar_kwargs') }}
- -## Additional features - -There are several more additional features to customize the animation. - -### Formatting the period - -Format the label of the period by setting `period_fmt` to a string with either a date directive or a new-style formatted string. - -```python -df.bcr.bar_chart_race(period_fmt='%b %-d, %Y') -``` - -
{{ video('other_date_directive') }}
- -### Use numbers for the index instead of dates - -It's not necessary to have dates or times in the index of the DataFrame. Below, the index is dropped, which replaces it with integers beginning at 0. These are then interpolated and formatted. - -```python -bcr.bar_chart_race(df.reset_index(drop=True), interpolate_period=True, - period_fmt='Index value - {x:.2f}') -``` - -
{{ video('other_string_fmt') }}
- -### Add text summarizing the entire period - -Define a function that accepts two arguments, the values and ranks of the current period of data, and returns -a dictionary that will be passed to the matplotlib `text` function. - -```python -def summary(values, ranks): - total_deaths = int(round(values.sum(), -2)) - s = f'Total Deaths - {total_deaths:,.0f}' - return {'x': .99, 'y': .05, 's': s, 'ha': 'right', 'size': 8} - -df.bcr.bar_chart_race(period_summary_func=summary) -``` - -
{{ video('other_summary') }}
- -## Add a perpendicular bar - -Add a single bar perpendicular to the main bars by defining a function that accepts two arguments, the values and ranks of the current period of data, and returns a single number, the position of the bar. You can use string names of aggregation functions that pandas understands. - -```python -df.bcr.bar_chart_race(perpendicular_bar_func='mean') -``` - -
{{ video('other_perpendicular') }}
- -An example with a user-defined function: - -```python -def func(values, ranks): - return values.quantile(.9) -df.bcr.bar_chart_race(perpendicular_bar_func=func) -``` - -
{{ video('other_perpendicular_func') }}
- -## Bar colors - -By default, the `'dark12'` colormap is used, with 12 unique colors. This is a qualitative color map containing every other color from the 'dark24' colormap originally found from the [plotly express documentation](https://plotly.com/python/discrete-color/#color-sequences-in-plotly-express). All [matplotlib](https://matplotlib.org/tutorials/colors/colormaps.html) and [plotly](https://plotly.com/python/builtin-colorscales/) colormaps are available by name. The entire `'dark24'` colormap will be used by default when your DataFrame contains more than 12 columns. - -```python -df.bcr.bar_chart_race(cmap='antique') -``` - -
{{ video('color_map') }}
- -### Reduce color repetition - -It is possible that some colors repeat in your animation, even if there are more colors in the colormap than bars in the animation. This will only happen if you set the `n_bars` parameter, as colors are assigned to each column upon. You'll get a warning advising you to set -`filter_column_colors` to `True`, which will only assign colors to those bars appearing in the animation. - -The following example uses the Accent colormap which has 8 unique colors. The animation is set to have a maximum of 7 bars, but there are still repeating colors. - -```python -df.bcr.bar_chart_race(cmap='accent', n_bars=7) -``` - -!!! warning "`UserWarning`" - Some of your columns never make an appearance in the animation. To reduce color repetition, set `filter_column_colors` to `True` - -
{{ video('color_warning') }}
- -Setting `filter_column_colors` to `True` will reduce the likelihood of repeating colors, but will still happen if the total number of unique bars is more than the number of colors in the colormap. - -```python -df.bcr.bar_chart_race(cmap='accent', n_bars=7, filter_column_colors=True) -``` - -
{{ video('color_warning_fixed') }}
- -## Using your own figure - -If you want to highly customize the animation, set the `fig` parameter to a previously created figure. This figure must have at aleast one matplotlib axes created within it. - -```python -fig, ax = plt.subplots(figsize=(5, 2), dpi=120) -ax.set_facecolor((0, 0, 1, .3)) -df.bcr.bar_chart_race(n_bars=3, fig=fig) -``` - -
{{ video('other_figure') }}
- -### With subplots - -It's possible to add an animation to a matplotlib figure containing multiple subplots. The first subplot will be used for the animation. - -```python -from matplotlib import dates -fig, ax_array = plt.subplots(2, 2, figsize=(8, 4), dpi=120, tight_layout=True) -ax1, ax2, ax3, ax4 = ax_array.flatten() -fig.suptitle('Animation in First Axes', y=1) - -ax2.plot(df) -ax2.xaxis.set_major_locator(dates.DayLocator([3, 7, 12])) -ax3.bar(df.index, df.median(axis=1)) -ax3.xaxis.set_major_locator(dates.DayLocator([3, 7, 12])) -ax4.pie(df.iloc[-1], radius=1.5, labels=df.columns) - -df.bcr.bar_chart_race(n_bars=3, fig=fig) -``` - -
{{ video('other_subplots') }}
- -## Saving the animation - -### Default returned values - -By default, the video will be embedded into your Jupyter Notebook. If you are not in a Jupyter Notebook, but have IPython installed, an `HTML` object will be returned. Retrieve the underlying HTML with the `data` attribute. - -```python -html = bcr.bar_chart_race(df) -html.data # very long string of HTML -``` - -If you do not have IPython installed, then a string of HTML will be returned directly. - -### Saving to disk - -In order to save the animation to disk, use a string of the file name of where you'd like to save as the second argument. You'll need to [install ffmpeg](../installation#installing-ffmpeg) first in order to save the animation. Once installed, you'll be able to save the animation as a wide variety of formats (mp4, m4v, mov, etc...). To save the animation as a gif, install ImageMagick. - -``` -df.bcr.bar_chart_race('docs/videos/covid19.mp4', figsize=(5, 3)) -``` - -### Matplotlib writer - -To customize the animation, set the `writer` parameter to a matplotlib `MovieWriter` object instance. \ No newline at end of file diff --git a/docs/upcoming.md b/docs/upcoming.md deleted file mode 100644 index aa17ac1..0000000 --- a/docs/upcoming.md +++ /dev/null @@ -1,10 +0,0 @@ -# Upcoming Features - -* Support for Plotly animations -* Images within the bars -* Names within bars (as opposed to just tick labels) -* Tools to see colormaps - -## Request a feature - -Request a feature by [creating an issue on github](https://github.com/dexplo/bar_chart_race/issues). diff --git a/docs/whats_new.md b/docs/whats_new.md deleted file mode 100644 index 0d26450..0000000 --- a/docs/whats_new.md +++ /dev/null @@ -1,41 +0,0 @@ -# What's New - -## Version 0.2 - -Upcoming release on July xx, 2020 - -### Major New Features - -* Plotly animated bar charts with `bar_chart_race_plotly` -* Line chart races with `line_chart_race` - -#### Other enhancements - -* Integration directly into pandas DataFrames - `df.bcr.bar_chart_race` -* Bar label position able to be specified ('outside', 'inside', or None) using new parameter `bar_textposition` -* Bar label formatting possible with string or function using new parameter `bar_texttemplate` -* Added `end_period_pause` parameter that creates a pause (in milliseconds) at the end of each period -* Parameter `title`, in addition to a string, can also be a dictionary using `'label'` as the key for the title. Other keys may be used to control text properties -* Removed parameters `figsize` and `dpi` in favor of `fig_kwargs` dictionary capable of taking all matplotlib `Figure` parameters -* Figure background color able to be saved -* Several parameters changed name and order - -## Version 0.1 - -Released June 1, 2020 - -This is the first major release of bar_chart_race adding many features: - -* [Fixed bar position](../tutorial#fix-the-order-of-the-bars) -* [Fixed max value](../tutorial#fix-the-maximum-value) -* [Perpendicular bars](../tutorial#add-a-perpendicular-bar) -* [Interpolation of the period](../tutorial#change-animation-smoothness) -* [Formatting of the period label](../tutorial#formatting-the-period) -* [Period label summary](../tutorial#add-text-summarizing-the-entire-period) -* [Support for plotly colormaps](../tutorial#bar-colors) - -## Version 0.0.1 - -Released April 29, 2020 - -Genesis of bar_chart_race capable of producing smoothly transitioning bars with matplotlib and pandas. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml deleted file mode 100644 index 28345bc..0000000 --- a/mkdocs.yml +++ /dev/null @@ -1,61 +0,0 @@ -site_name: Bar Chart Race -site_description: Animated bar chart races in Python with the bar_chart_race package -site_author: Ted Petrou -site_url: https://www.dexplo.org/bar_chart_race -repo_url: https://github.com/dexplo/bar_chart_race -copyright: Copyright @ 2020 Ted Petrou -google_analytics: - - UA-119777567-7 - - dexplo.org - -theme: - name: material - favicon: images/favicon.ico - custom_dir: docs/overrides - features: - - tabs - -nav: - - Home: index.md - - Installation: installation.md - - What's New: whats_new.md - - Tutorial: tutorial.md - - Data Preparation: data_preparation.md - - Upcoming Features: upcoming.md - - API Reference: api.md - - Dexplo Libraries: - - Dexplo: https://www.dexplo.org - -extra_css: - - css/style.css - -extra: - social: - - icon: fontawesome/brands/github-alt - link: https://github.com/dexplo - - icon: fontawesome/brands/twitter - link: https://twitter.com/TedPetrou - - icon: fontawesome/brands/linkedin - link: https://linkedin.com/in/TedPetrou - - icon: fontawesome/brands/youtube - link: https://www.youtube.com/c/dunderdata - - icon: fontawesome/brands/facebook - link: https://www.facebook.com/dunderdata - -markdown_extensions: - - admonition - - toc: - permalink: True - - codehilite: - guess_lang: false - - pymdownx.superfences - -plugins: - - search - - macros - - minify: - minify_html: false - -extra_javascript: - - https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML - - https://cdn.plot.ly/plotly-latest.min.js \ No newline at end of file diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/data/lcr_data.csv b/tests/data/lcr_data.csv deleted file mode 100644 index a7bd56f..0000000 --- a/tests/data/lcr_data.csv +++ /dev/null @@ -1,8 +0,0 @@ -date,US,Brazil,United Kingdom,Mexico,Italy,India,France,Spain,Peru,Iran,Russia,Belgium,Chile,Germany,Colombia,Canada,South Africa,Netherlands,Pakistan,Sweden -2020-03-11,33,0,7,0,827,1,48,54,0,354,0,3,0,3,0,1,0,5,0,1 -2020-03-31,5605,201,2430,29,12428,35,3532,8464,30,2898,17,705,12,775,16,101,5,1040,27,180 -2020-04-20,43466,2587,19105,712,24114,592,20267,20852,445,5209,405,5828,139,4862,189,1727,58,3764,201,1580 -2020-05-10,80855,11123,31954,3465,30560,2212,26383,26621,1889,6640,1915,8656,312,7569,463,4991,194,5459,706,3225 -2020-05-30,104778,28834,38977,9779,33340,5185,28774,27125,4371,7734,4555,9453,997,8530,890,7159,643,5970,1483,4395 -2020-06-19,119739,48954,42653,20394,34561,12948,29620,28315,7660,9392,7831,9695,4093,8887,2045,8408,1831,6100,3382,5105 -2020-07-09,133290,69184,44687,33526,34926,21604,29982,28401,11314,12305,10826,9778,6682,9057,4714,8797,3720,6156,5058,5500 diff --git a/tests/test_bar_charts.py b/tests/test_bar_charts.py deleted file mode 100644 index 574fae3..0000000 --- a/tests/test_bar_charts.py +++ /dev/null @@ -1,109 +0,0 @@ -import pytest -import matplotlib.pyplot as plt -from bar_chart_race import load_dataset, bar_chart_race - - -df = load_dataset('covid19') -df = df.iloc[-20:-16] -df1 = df.reset_index(drop=True) - - -class TestSimpleBC: - - def test_defaults(self): - bar_chart_race(df) - bar_chart_race(df, orientation='v') - - def test_sort(self): - bar_chart_race(df, sort='asc') - bar_chart_race(df, orientation='v', sort='asc') - - def test_nbars(self): - bar_chart_race(df, sort='desc', n_bars=8) - bar_chart_race(df, orientation='v', sort='desc', n_bars=8) - - def test_fixed_order(self): - bar_chart_race(df, sort='asc', n_bars=8, fixed_order=True) - bar_chart_race(df, fixed_order=['Iran', 'USA', 'Italy', 'Spain']) - - def test_fixed_max(self): - bar_chart_race(df, fixed_max=True) - - def test_steps_per_period(self): - bar_chart_race(df, sort='asc', steps_per_period=2) - bar_chart_race(df, sort='asc', steps_per_period=30) - - def test_interpolate_period(self): - bar_chart_race(df, interpolate_period=True, n_bars=8) - - def test_bar_size(self): - bar_chart_race(df, n_bars=8, bar_size=.99) - - def test_period_label(self): - bar_chart_race(df, n_bars=8, period_label=False) - bar_chart_race(df, n_bars=8, period_label={'x': .99, 'y': .1, 'ha': 'right'}) - - def test_period_fmt(self): - bar_chart_race(df, n_bars=8, period_template='%b %d, %Y') - bar_chart_race(df1, n_bars=8, interpolate_period=True, period_template='{x: .2f}') - - def test_period_summary_func(self): - def summary(values, ranks): - total_deaths = int(round(values.sum(), -2)) - s = f'Total Deaths - {total_deaths:,.0f}' - return {'x': .99, 'y': .05, 's': s, 'ha': 'right', 'size': 8} - - bar_chart_race(df, n_bars=8, period_summary_func=summary) - - def test_perpendicular_bar_func(self): - bar_chart_race(df, n_bars=8, perpendicular_bar_func='mean') - def func(values, ranks): - return values.quantile(.9) - - bar_chart_race(df, n_bars=8, perpendicular_bar_func=func) - - def test_period_length(self): - bar_chart_race(df, n_bars=8, period_length=1200) - - def test_figsize(self): - bar_chart_race(df, fig_kwargs={'figsize': (4, 2), 'dpi': 120}) - - def test_filter_column_colors(self): - with pytest.warns(UserWarning): - bar_chart_race(df, n_bars=6, sort='asc', colors='Accent') - - bar_chart_race(df, n_bars=6, sort='asc', colors='Accent', filter_column_colors=True) - bar_chart_race(df, n_bars=6, colors=plt.cm.tab20.colors[:19]) - - def test_colors(self): - bar_chart_race(df, colors=['red', 'blue'], filter_column_colors=True) - - with pytest.raises(KeyError): - bar_chart_race(df, colors='adf') - - def test_title(self): - bar_chart_race(df, n_bars=6, title='Great title') - bar_chart_race(df, n_bars=6, title={'label': 'Great title', 'size':20}) - - def test_shared_fontdict(self): - bar_chart_race(df, n_bars=6, shared_fontdict={'family': 'Courier New', - 'weight': 'bold', 'color': 'teal'}) - - def test_scale(self): - bar_chart_race(df, n_bars=6, scale='log') - - def test_save(self): - bar_chart_race(df, 'tests/videos/test.mp4', n_bars=6) - bar_chart_race(df, 'tests/videos/test.gif', n_bars=6, writer='imagemagick') - bar_chart_race(df, 'tests/videos/test.html', n_bars=6) - - def test_writer(self): - bar_chart_race(df, 'tests/videos/test.mpeg', n_bars=6, writer='imagemagick') - - def test_fig(self): - fig, ax = plt.subplots(dpi=100) - bar_chart_race(df, n_bars=6, fig=fig) - - def test_bar_kwargs(self): - bar_chart_race(df, n_bars=6, bar_kwargs={'alpha': .2, 'ec': 'black', 'lw': 3}) - \ No newline at end of file diff --git a/tests/test_line_chart.py b/tests/test_line_chart.py deleted file mode 100644 index fb9b9f3..0000000 --- a/tests/test_line_chart.py +++ /dev/null @@ -1,130 +0,0 @@ -import pytest -import pandas as pd -import matplotlib.pyplot as plt -import bar_chart_race as bcr - - -df_race = pd.read_csv('tests/data/lcr_data.csv', index_col='date', parse_dates=['date']) -s = pd.Series({'US': 330, 'United Kingdom': 65, 'Brazil': 220, 'Italy': 60, 'France': 126}) -df_pop = df_race[s.index] / s - - -class TestBasics: - - def test_default(self): - bcr.line_chart_race(df_race.iloc[:, -5:]) - - def test_lines(self): - bcr.line_chart_race(df_race, n_lines=8) - - def test_images(self): - bcr.line_chart_race(df_race, n_lines=4, images='country') - - def test_others_line_func(self): - bcr.line_chart_race(df_race, n_lines=4, images='country', others_line_func=True) - - def test_steps_per_period(self): - bcr.line_chart_race(df_race, n_lines=4, images='country', others_line_func=True, steps_per_period=20) - bcr.line_chart_race(df_race, n_lines=4, images='country', others_line_func=True, steps_per_period=3) - - def test_period_length(self): - bcr.line_chart_race(df_race, n_lines=4, images='country', others_line_func=True, - period_length=200, steps_per_period=30) - - def test_others_line_func_agg(self): - bcr.line_chart_race(df_race, n_lines=4, images='country', others_line_func='mean', steps_per_period=5) - bcr.line_chart_race(df_race, n_lines=4, images='country', others_line_func='mean', - others_line_kwargs={'s': 'Mean Others', 'color':'.5', 'lw': 3}, steps_per_period=5) - bcr.line_chart_race(df_race, n_lines=4, images='country', others_line_func='mean', steps_per_period=5) - - def test_others_line_func_udf(self): - bcr.line_chart_race(df_race, n_lines=4, images='country', others_line_func=lambda x: x.sum(), - others_line_kwargs={'s': 'Sum Others', 'color':'.5', 'lw': 3}, steps_per_period=5) - - def test_agg_line_func(self): - bcr.line_chart_race(df_race, n_lines=4, images='country', others_line_func=lambda x: x.sum(), - period_length=1000, others_line_kwargs={'s': 'Sum Others', 'lw': 3, 'ls': '--'}, - agg_line_func='median', agg_line_kwargs={'s': 'Median All'}, - steps_per_period=5) - - bcr.line_chart_race(df_race, n_lines=4, images='country', others_line_func=lambda x: x.sum(), - period_length=1000, others_line_kwargs={'s': 'Sum Others', 'lw': 3, 'ls': '--'}, - agg_line_func='sum', agg_line_kwargs={'s': 'Sum All'}, - steps_per_period=5) - - bcr.line_chart_race(df_race, n_lines=4, images='country', others_line_func=lambda x: x.sum(), - period_length=1000, end_period_pause=1000, - others_line_kwargs={'s': 'Sum Others', 'lw': 3, 'ls': '--'}, - agg_line_func='median', agg_line_kwargs={'s': 'Median Shown'}, - steps_per_period=5) - - def test_period_summary_func(self): - def psf(values): - total = values.sum() - s = f'Worldwide Deaths: {total:,.0f}' - return {'x': .05, 'y': .85, 's': s, 'size': 10} - - bcr.line_chart_race(df_race, n_lines=4, images='country', others_line_func=lambda x: x.sum(), - others_line_kwargs={'s': 'Sum Others', 'lw': 3, 'ls': '--'}, - agg_line_func='sum', agg_line_kwargs={'s': 'Sum All'}, - steps_per_period=5, period_summary_func=psf) - - def test_line_width_data(self): - bcr.line_chart_race(df_race[df_pop.columns], n_lines=5, images='country', - steps_per_period=5, line_width_data=df_pop) - - def test_fade(self): - bcr.line_chart_race(df_race[df_pop.columns], images='country', - steps_per_period=5, line_width_data=df_pop, fade=.9) - - bcr.line_chart_race(df_race[df_pop.columns], n_lines=5, images='country', - steps_per_period=5, line_width_data=df_pop, fade=.8, min_fade=0) - - def test_images(self): - url = 'https://icons.iconarchive.com/icons/wikipedia/flags/1024/US-United-States-Flag-icon.png' - images = [url] * 5 - bcr.line_chart_race(df_race, n_lines=5, images=images, title='COVID-19 Deaths', - steps_per_period=5, line_width_data=df_pop, fade=.9) - - def test_colors(self): - bcr.line_chart_race(df_race, n_lines=5, images='country', steps_per_period=5, colors='tab20') - - bcr.line_chart_race(df_race, n_lines=5, images='country', steps_per_period=5, colors=plt.cm.Accent) - - def test_font(self): - bcr.line_chart_race(df_race, n_lines=5, images='country', steps_per_period=5, line_label_font=5, - tick_label_font=4) - - bcr.line_chart_race(df_race, n_lines=5, images='country', steps_per_period=5, - line_label_font={'size': 9, 'color': 'red'}, tick_label_font=4) - - def test_tick_template(self): - bcr.line_chart_race(df_race, n_lines=5, images='country', steps_per_period=5, - tick_template=lambda x, pos: f'{x / 1000:.0f}k') - - bcr.line_chart_race(df_race, n_lines=5, images='country', steps_per_period=5, - tick_template='deaths {x:.2f}') - - def test_scale(self): - bcr.line_chart_race(df_race, n_lines=5, images='country', steps_per_period=5, scale='linear') - - def test_fig(self): - fig = plt.Figure(figsize=(6, 3), facecolor='tan', dpi=120) - fig.add_subplot(1, 2, 1) - fig.add_subplot(1, 2, 2) - bcr.line_chart_race(df_race, n_lines=5, images='country', steps_per_period=5, fig=fig) - - def test_line_kwargs(self): - bcr.line_chart_race(df_race, n_lines=5, images='country', - steps_per_period=5, line_kwargs={"ls": '--', 'lw': 2, 'alpha': .3}) - - def test_fig_kwargs(self): - bcr.line_chart_race(df_race, n_lines=5, images='country', - steps_per_period=5, fig_kwargs={'figsize': (4, 2), 'dpi': 100, 'facecolor': 'yellow'}) - - def test_videos(self): - bcr.line_chart_race(df_race, 'tests/videos/lcr_yellow.mp4', n_lines=5, images='country', - steps_per_period=5, fig_kwargs={'facecolor': 'yellow'}) - - bcr.line_chart_race(df_race, 'tests/videos/test_html.html', n_lines=5, images='country', - steps_per_period=5) diff --git a/tests/test_plotly.py b/tests/test_plotly.py deleted file mode 100644 index d3890c0..0000000 --- a/tests/test_plotly.py +++ /dev/null @@ -1,94 +0,0 @@ -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import bar_chart_race as bcr -import plotly.graph_objects as go -import plotly -from plotly.subplots import make_subplots -from bar_chart_race import load_dataset, bar_chart_race_plotly - - -df = load_dataset('covid19') -df = df.iloc[-20:-10] -df1 = df.reset_index(drop=True) - - -def test_all(): - bar_chart_race_plotly(df) - - df.bcr.bar_chart_race_plotly() - - bar_chart_race_plotly(df, sort='asc') - - bar_chart_race_plotly(df, orientation='v', slider=False) - - bar_chart_race_plotly(df, orientation='v', sort='asc', slider=False) - - bar_chart_race_plotly(df, sort='desc', n_bars=8) - - bar_chart_race_plotly(df, orientation='v', sort='desc', n_bars=8) - - bar_chart_race_plotly(df, sort='asc', n_bars=8, fixed_order=True) - - bar_chart_race_plotly(df, fixed_order=['Iran', 'USA', 'Italy', 'Spain'], period_label={'x': .95, 'y': .9}) - - bar_chart_race_plotly(df, fixed_max=True) - - bar_chart_race_plotly(df, fixed_max=True, orientation='v') - - bar_chart_race_plotly(df, sort='asc', steps_per_period=2) - - bar_chart_race_plotly(df, interpolate_period=True, n_bars=8) - - bar_chart_race_plotly(df, n_bars=8, textposition='inside') - - bar_chart_race_plotly(df, n_bars=8, bar_size=.99, layout_kwargs={'height': 800}) - - bar_chart_race_plotly(df, n_bars=8, period_label=False) - - bar_chart_race_plotly(df, n_bars=8, sort='asc', orientation='h', period_label={'bgcolor': 'orange', - 'font': {'color': 'blue', 'size': 30}}) - - bar_chart_race_plotly(df, n_bars=8, period_template='%b %d, %Y') - - bar_chart_race_plotly(df1, n_bars=8, period_template='{x:.1f}', interpolate_period=True) - - bar_chart_race_plotly(df, n_bars=8, interpolate_period=False, bar_textposition='outside', - period_length=500, steps_per_period=10, fixed_max=True) - - def summary(values, ranks): - total_deaths = int(round(values.sum(), -2)) - s = f'Total Deaths - {total_deaths:,.0f}' - return {'x': .99, 'y': .05, 'text': s, 'align': 'right', 'size': 8} - - bar_chart_race_plotly(df, n_bars=8, period_summary_func=summary) - - bar_chart_race_plotly(df, n_bars=8, period_summary_func=summary, perpendicular_bar_func='mean') - - bar_chart_race_plotly(df, n_bars=8, period_summary_func=summary, perpendicular_bar_func='max', fixed_max=True) - - def func(values, ranks): - return values.quantile(.9) - - bar_chart_race_plotly(df, n_bars=8, period_summary_func=summary, perpendicular_bar_func=func) - - bar_chart_race_plotly(df, n_bars=8, period_length=1200) - - bar_chart_race_plotly(df, n_bars=6, sort='asc', colors='Accent') - - bar_chart_race_plotly(df, n_bars=6, sort='asc', colors='Accent', filter_column_colors=True) - - - bar_chart_race_plotly(df, n_bars=6, colors=plt.cm.tab20.colors[:19]) - - bar_chart_race_plotly(df, colors=['red', 'blue'], filter_column_colors=True) - - bar_chart_race_plotly(df, n_bars=6, title={'text':'Great title', 'font': {'size': 40}, 'x': .5}) - - bar_chart_race_plotly(df, n_bars=6, bar_label_font=8, tick_label_font=20) - - bar_chart_race_plotly(df, n_bars=6, bar_label_font={'size': 18, 'family': 'Courier New, monospace', 'color': 'red'}) - - bar_chart_race_plotly(df, n_bars=6, scale='log') - - bar_chart_race_plotly(df, 'test.html', n_bars=6, write_html_kwargs={'auto_play': False}) diff --git a/tests/test_prepare.py b/tests/test_prepare.py deleted file mode 100644 index bef03d6..0000000 --- a/tests/test_prepare.py +++ /dev/null @@ -1,25 +0,0 @@ -import pandas as pd -import bar_chart_race as bcr - - -class TestLoadData: - - def test_load_urban_pop(self): - bcr.load_dataset('urban_pop') - - def test_load_covid(self): - bcr.load_dataset('covid19') - - -# class TestPrepareWideData: - -# df_wide = pd.read_csv('data/covid_test.csv', index_col='date', parse_dates=['date']) - -# def test_prepare_wide_data(self): -# df_wide_values, df_wide_ranks = bcr.prepare_wide_data(self.df_wide) -# df_wide_values_ans = pd.read_csv('data/covid_test_values.csv', -# index_col='date', parse_dates=['date']) -# df_wide_ranks_ans = pd.read_csv('data/covid_test_ranks.csv', -# index_col='date', parse_dates=['date']) -# pd.testing.assert_frame_equal(df_wide_values, df_wide_values_ans) -# pd.testing.assert_frame_equal(df_wide_ranks, df_wide_ranks_ans) diff --git a/tests/videos/README.md b/tests/videos/README.md deleted file mode 100644 index 722a69e..0000000 --- a/tests/videos/README.md +++ /dev/null @@ -1 +0,0 @@ -# Test videos saved here \ No newline at end of file