Skip to content

Instantly share code, notes, and snippets.

@unixpickle
Created November 23, 2018 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unixpickle/f8dc8664fb5bf7a92b1b3e9ac52a97da to your computer and use it in GitHub Desktop.
Save unixpickle/f8dc8664fb5bf7a92b1b3e9ac52a97da to your computer and use it in GitHub Desktop.
Actor Signs
"""
Histogram actors by birthday and astrological sign.
"""
import datetime
import re
import requests
def main():
d = datetime.datetime(2000, 1, 1)
counts = {}
while d.year < 2001:
url = ('https://www.imdb.com/search/name?birth_monthday=%d-%d&refine=birth_monthday&ref_=nm_ov_bth_monthday' %
(d.month, d.day))
response = requests.get(url)
match = re.search('1-50 of ([0-9,]*) names.', response.text)
count = int(match.group(1).replace(',', ''))
print('%d/%d - %d' % (d.month, d.day, count))
key = sign(d.day, d.month)
counts[key] = counts.get(key, 0) + count
d += datetime.timedelta(days=1)
print(counts)
def sign(day, month):
# https://www.w3resource.com/python-exercises/python-conditional-exercise-38.php
if month == 12:
astro_sign = 'sagittarius' if (day < 22) else 'capricorn'
elif month == 1:
astro_sign = 'capricorn' if (day < 20) else 'aquarius'
elif month == 2:
astro_sign = 'aquarius' if (day < 19) else 'pisces'
elif month == 3:
astro_sign = 'pisces' if (day < 21) else 'aries'
elif month == 4:
astro_sign = 'aries' if (day < 20) else 'taurus'
elif month == 5:
astro_sign = 'taurus' if (day < 21) else 'gemini'
elif month == 6:
astro_sign = 'gemini' if (day < 21) else 'cancer'
elif month == 7:
astro_sign = 'cancer' if (day < 23) else 'leo'
elif month == 8:
astro_sign = 'leo' if (day < 23) else 'virgo'
elif month == 9:
astro_sign = 'virgo' if (day < 23) else 'libra'
elif month == 10:
astro_sign = 'libra' if (day < 23) else 'scorpio'
elif month == 11:
astro_sign = 'scorpio' if (day < 22) else 'sagittarius'
return astro_sign
if __name__ == '__main__':
main()
"""
Plot sign data.
"""
import matplotlib.pyplot as plt
DATA = {'capricorn': 31635, 'aquarius': 33150, 'pisces': 35144, 'aries': 33566, 'taurus': 34794,
'gemini': 34373, 'cancer': 35393, 'leo': 34808, 'virgo': 34714, 'libra': 33193,
'scorpio': 32331, 'sagittarius': 32076}
def main():
indices = list(range(len(DATA)))
plt.bar(indices, list(DATA.values()))
plt.xticks(indices, list(DATA.keys()))
plt.show()
if __name__ == '__main__':
main()
1/1 - 1734
1/2 - 1058
1/3 - 1060
1/4 - 1099
1/5 - 1075
1/6 - 1116
1/7 - 1088
1/8 - 1064
1/9 - 1024
1/10 - 1090
1/11 - 1078
1/12 - 1074
1/13 - 1066
1/14 - 1106
1/15 - 1126
1/16 - 1063
1/17 - 1163
1/18 - 1023
1/19 - 1072
1/20 - 1156
1/21 - 1084
1/22 - 1040
1/23 - 1061
1/24 - 1062
1/25 - 1074
1/26 - 1032
1/27 - 1073
1/28 - 1105
1/29 - 1107
1/30 - 1041
1/31 - 1079
2/1 - 1085
2/2 - 1218
2/3 - 1142
2/4 - 1072
2/5 - 1108
2/6 - 1087
2/7 - 1116
2/8 - 1079
2/9 - 1114
2/10 - 1045
2/11 - 1085
2/12 - 1190
2/13 - 1063
2/14 - 1265
2/15 - 1096
2/16 - 1139
2/17 - 1185
2/18 - 1147
2/19 - 1092
2/20 - 1159
2/21 - 1125
2/22 - 1249
2/23 - 1115
2/24 - 1139
2/25 - 1180
2/26 - 1183
2/27 - 1118
2/28 - 1193
2/29 - 317
3/1 - 1212
3/2 - 1088
3/3 - 1291
3/4 - 1164
3/5 - 1152
3/6 - 1136
3/7 - 1126
3/8 - 1182
3/9 - 1151
3/10 - 1224
3/11 - 1106
3/12 - 1164
3/13 - 1132
3/14 - 1147
3/15 - 1214
3/16 - 1135
3/17 - 1126
3/18 - 1209
3/19 - 1134
3/20 - 1181
3/21 - 1124
3/22 - 1132
3/23 - 1152
3/24 - 1160
3/25 - 1081
3/26 - 1094
3/27 - 1142
3/28 - 1135
3/29 - 1085
3/30 - 1026
3/31 - 1156
4/1 - 1255
4/2 - 1117
4/3 - 1116
4/4 - 1287
4/5 - 1070
4/6 - 1102
4/7 - 1155
4/8 - 1093
4/9 - 1081
4/10 - 1064
4/11 - 1022
4/12 - 1113
4/13 - 1048
4/14 - 1070
4/15 - 1195
4/16 - 1187
4/17 - 1114
4/18 - 1096
4/19 - 1094
4/20 - 1105
4/21 - 1134
4/22 - 1099
4/23 - 1133
4/24 - 1146
4/25 - 1108
4/26 - 1143
4/27 - 1070
4/28 - 1098
4/29 - 1104
4/30 - 1098
5/1 - 1235
5/2 - 1071
5/3 - 1136
5/4 - 1070
5/5 - 1233
5/6 - 1088
5/7 - 1055
5/8 - 1119
5/9 - 1049
5/10 - 1154
5/11 - 1106
5/12 - 1123
5/13 - 1116
5/14 - 1194
5/15 - 1132
5/16 - 1118
5/17 - 1191
5/18 - 1145
5/19 - 1089
5/20 - 1132
5/21 - 1073
5/22 - 1106
5/23 - 1141
5/24 - 1104
5/25 - 1160
5/26 - 1097
5/27 - 1091
5/28 - 1121
5/29 - 1064
5/30 - 1136
5/31 - 1032
6/1 - 1134
6/2 - 1113
6/3 - 1067
6/4 - 1084
6/5 - 1053
6/6 - 1238
6/7 - 1081
6/8 - 1056
6/9 - 1046
6/10 - 1177
6/11 - 1039
6/12 - 1158
6/13 - 1072
6/14 - 1119
6/15 - 1216
6/16 - 1137
6/17 - 1124
6/18 - 1105
6/19 - 1166
6/20 - 1063
6/21 - 1144
6/22 - 1125
6/23 - 1150
6/24 - 1122
6/25 - 1095
6/26 - 1124
6/27 - 1061
6/28 - 1098
6/29 - 1115
6/30 - 1072
7/1 - 1104
7/2 - 1039
7/3 - 1070
7/4 - 1188
7/5 - 1054
7/6 - 1023
7/7 - 1243
7/8 - 1090
7/9 - 1123
7/10 - 1179
7/11 - 1035
7/12 - 1087
7/13 - 1117
7/14 - 1156
7/15 - 1150
7/16 - 1055
7/17 - 1128
7/18 - 1100
7/19 - 1093
7/20 - 1108
7/21 - 1101
7/22 - 1044
7/23 - 1123
7/24 - 1071
7/25 - 1101
7/26 - 1127
7/27 - 1131
7/28 - 1075
7/29 - 1079
7/30 - 1085
7/31 - 1121
8/1 - 1135
8/2 - 1167
8/3 - 1087
8/4 - 1102
8/5 - 1118
8/6 - 1133
8/7 - 1130
8/8 - 1197
8/9 - 1120
8/10 - 1122
8/11 - 1064
8/12 - 1145
8/13 - 1153
8/14 - 1164
8/15 - 1195
8/16 - 1131
8/17 - 1135
8/18 - 1113
8/19 - 1154
8/20 - 1100
8/21 - 1123
8/22 - 1107
8/23 - 1183
8/24 - 1098
8/25 - 1121
8/26 - 1006
8/27 - 1085
8/28 - 1193
8/29 - 1070
8/30 - 974
8/31 - 1068
9/1 - 1223
9/2 - 1139
9/3 - 1043
9/4 - 1085
9/5 - 1076
9/6 - 1096
9/7 - 1058
9/8 - 1063
9/9 - 1175
9/10 - 1152
9/11 - 1114
9/12 - 1137
9/13 - 1130
9/14 - 1130
9/15 - 1220
9/16 - 1173
9/17 - 1082
9/18 - 1076
9/19 - 1226
9/20 - 1134
9/21 - 1206
9/22 - 1178
9/23 - 1131
9/24 - 1142
9/25 - 1156
9/26 - 1093
9/27 - 1177
9/28 - 1168
9/29 - 1161
9/30 - 1036
10/1 - 1207
10/2 - 1067
10/3 - 1074
10/4 - 1206
10/5 - 1138
10/6 - 1062
10/7 - 1118
10/8 - 1099
10/9 - 1108
10/10 - 1262
10/11 - 1030
10/12 - 1096
10/13 - 1051
10/14 - 1097
10/15 - 1073
10/16 - 1070
10/17 - 1099
10/18 - 1030
10/19 - 1050
10/20 - 1101
10/21 - 1025
10/22 - 1066
10/23 - 1070
10/24 - 1071
10/25 - 1134
10/26 - 1060
10/27 - 1024
10/28 - 1085
10/29 - 1013
10/30 - 1074
10/31 - 1108
11/1 - 1110
11/2 - 1088
11/3 - 1051
11/4 - 1096
11/5 - 1033
11/6 - 1025
11/7 - 1088
11/8 - 1109
11/9 - 1020
11/10 - 1153
11/11 - 1190
11/12 - 1069
11/13 - 1036
11/14 - 1079
11/15 - 1133
11/16 - 1079
11/17 - 1050
11/18 - 1076
11/19 - 1086
11/20 - 1062
11/21 - 1059
11/22 - 1120
11/23 - 1018
11/24 - 1093
11/25 - 1060
11/26 - 1037
11/27 - 1099
11/28 - 1042
11/29 - 1036
11/30 - 1161
12/1 - 1090
12/2 - 1042
12/3 - 1043
12/4 - 994
12/5 - 1088
12/6 - 1050
12/7 - 1068
12/8 - 1105
12/9 - 1051
12/10 - 1018
12/11 - 1045
12/12 - 1224
12/13 - 1062
12/14 - 1043
12/15 - 1129
12/16 - 1039
12/17 - 1005
12/18 - 1062
12/19 - 1093
12/20 - 1065
12/21 - 1094
12/22 - 1014
12/23 - 1098
12/24 - 1080
12/25 - 1111
12/26 - 962
12/27 - 1019
12/28 - 1068
12/29 - 1042
12/30 - 1029
12/31 - 1033
{'capricorn': 31635, 'aquarius': 33150, 'pisces': 35144, 'aries': 33566, 'taurus': 34794, 'gemini': 34373, 'cancer': 35393, 'leo': 34808, 'virgo': 34714, 'libra': 33193, 'scorpio': 32331, 'sagittarius': 32076}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment