Skip to main content

解决bar_chart_race无法显示中文的问题

Project description

bar_char_race_cn库

解决bar_chart_race库不支持中文的问题

安装

pip install bar_char_race_cn

注意:

使用前需提前安装ffmpeg

使用

请到github下载测试数据

import pandas as pd

df = pd.read_csv('data/财政收入.csv')

def year2timestamp(year):
    #转为可比较大小的日期格式
    return pd.Timestamp(str(year))

df['year'] = df['year'].apply(year2timestamp)
df.set_index('year', inplace=True)
df.sort_index(inplace=True) #日期从小到大排序
import bar_chart_race_cn as bcr

bcr.bar_chart_race(df=df,
                   filename='近20年各省财政收入.mp4',
                   title='近20年各省财政收入(单位: 亿元)'
                  )

更多

支持一下

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

bar_chart_race_cn-0.11-py3-none-any.whl (153.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page