pyecharts中的Faker详解
一 导入Faker
from pyecharts.faker import Faker
在导入Faker之前我们需要安装pyecharts,通过cmd命令端输入:pip install pyecharts
二 Faker中函数的介绍
函数名称 | 对应内容 |
---|
Faker.clothes | [“衬衫”, “毛衣”, “领带”, “裤子”, “风衣”, “高跟鞋”, “袜子”] | Faker.drinks | [“可乐”, “雪碧”, “橙汁”, “绿茶”, “奶茶”, “百威”, “青岛”] | Faker.phones | [“小米”, “三星”, “华为”, “苹果”, “魅族”, “VIVO”, “OPPO”] | Faker.fruits | [“草莓”, “芒果”, “葡萄”, “雪梨”, “西瓜”, “柠檬”, “车厘子”] | Faker.animal | [“河马”, “蟒蛇”, “老虎”, “大象”, “兔子”, “熊猫”, “狮子”] | Faker.cars | [“宝马”, “法拉利”, “奔驰”, “奥迪”, “大众”, “丰田”, “特斯拉”] | Faker.dogs | [“哈士奇”, “萨摩耶”, “泰迪”, “金毛”, “牧羊犬”, “吉娃娃”, “柯基”] | Faker.week | [“周一”, “周二”, “周三”, “周四”, “周五”, “周六”, “周日”] | Faker.week_en | [‘Saturday’, ‘Friday’, ‘Thursday’, ‘Wednesday’, ‘Tuesday’, ‘Monday’, ‘Sunday’] | Faker.clock | [‘12a’,‘1a’,‘2a’,‘3a’,‘4a’,‘5a’,‘6a’,‘7a’,‘8a’,‘9a’,‘10a’,‘11a’,‘12p’,‘1p’,‘2p’,‘3p’,‘4p’,‘5p’,‘6p’,‘7p’,‘8p’,‘9p’,‘10p’,‘11p’] | Faker.visual_color | [ “#313695”, “#4575b4”, “#74add1”, “#abd9e9”, “#e0f3f8”,"#ffffbf","#fee090","#fdae61","#f46d43", “#d73027”,"#a50026"] | Faker.months | [‘1月’, ‘2月’, ‘3月’, ‘4月’, ‘5月’, ‘6月’, ‘7月’, ‘8月’, ‘9月’, ‘10月’, ‘11月’, ‘12月’]即 ["{}月".format(i) for i in range(1, 13)] | Faker.provinces | [“广东”, “北京”, “上海”, “江西”, “湖南”, “浙江”, “江苏”] | Faker.guangdong_city | [“汕头市”, “汕尾市”, “揭阳市”, “阳江市”, “肇庆市”, “广州市”, “惠州市”] | Faker.country | [‘China’, ‘Canada’, ‘Brazil’, ‘Russia’, ‘United States’, ‘Africa’, ‘Germany’] | Faker.days_attrs | [‘0天’,‘1天’,‘2天’,‘3天’,‘4天’,‘5天’,‘6天’, ‘7天’,‘8天’,‘9天’,‘10天’,‘11天’,‘12天’,‘13天’, ‘14天’,‘15天’,‘16天’,‘17天’,‘18天’,‘19天’,‘20天’, ‘21天’,‘22天’,‘23天’,‘24天’,‘25天’,‘26天’,‘27天’,‘28天’,‘29天’]即 ["{}天".format(i) for i in range(30)] | Faker.days_values | 生成的从1-30之间的随机天数,顺序是打乱的,排序后是1-30 |
三 Faker.choose()的介绍
输入Faker.choose()之后生成的结果是从 Faker.clothes, Faker.drinks, Faker.phones, Faker.fruits, Faker.animal, Faker.dogs, Faker.week, 这几个中随机生成的一个结果,并且生成的数量都是7个
四 values介绍
Faker.values()
生成7个随机整数,这7个随机整数一般是两位数和三位数的组合
|