|
127 | 127 | "metadata": {},
|
128 | 128 | "outputs": [],
|
129 | 129 | "source": [
|
130 |
| - "def PlotPercentFreq(df, field, title, xlim):\n", |
| 130 | + "def plot_percent_freq(df, field, title, xlim):\n", |
131 | 131 | " order = df[field].value_counts().index\n",
|
132 | 132 | " total = len(df)\n",
|
133 | 133 | " sns.barplot(y=df[field].value_counts().index, x=df[field].value_counts().values/total, order=order)\n",
|
|
143 | 143 | "metadata": {},
|
144 | 144 | "outputs": [],
|
145 | 145 | "source": [
|
146 |
| - "def PlotTop10LanguagePercentage(df, title, xlim):\n", |
| 146 | + "def plot_top10_language_percentage(df, title, xlim):\n", |
147 | 147 | " language_counts = df.groupby(['user_alias', 'language']).size().unstack(fill_value=0)\n",
|
148 | 148 | " total_repos = df.groupby('user_alias').size()\n",
|
149 | 149 | " language_percentages = (language_counts.T / total_repos).T * 100\n",
|
|
167 | 167 | "metadata": {},
|
168 | 168 | "outputs": [],
|
169 | 169 | "source": [
|
170 |
| - "def PlotScatter(df, field_x, field_y, field_type, title):\n", |
| 170 | + "def plot_scatter(df, field_x, field_y, field_type, title):\n", |
171 | 171 | " plt.figure(figsize=(10, 6))\n",
|
172 | 172 | " sns.scatterplot(x=field_x, y=field_y, hue=field_type, data=df)\n",
|
173 | 173 | " plt.title(title)\n",
|
|
1255 | 1255 | }
|
1256 | 1256 | ],
|
1257 | 1257 | "source": [
|
1258 |
| - "PlotPercentFreq(event_data, 'event_type', title='Percentage Of Event Type Frequency Of All User', xlim=0.65)" |
| 1258 | + "plot_percent_freq(event_data, 'event_type', title='Percentage Of Event Type Frequency Of All User', xlim=0.65)" |
1259 | 1259 | ]
|
1260 | 1260 | },
|
1261 | 1261 | {
|
|
1276 | 1276 | }
|
1277 | 1277 | ],
|
1278 | 1278 | "source": [
|
1279 |
| - "PlotPercentFreq(low_follower_event_data, 'event_type', title='Percentage Of Event Type Frequency Of Low-Follower User', xlim=0.65)" |
| 1279 | + "plot_percent_freq(low_follower_event_data, 'event_type', title='Percentage Of Event Type Frequency Of Low-Follower User', xlim=0.65)" |
1280 | 1280 | ]
|
1281 | 1281 | },
|
1282 | 1282 | {
|
|
1297 | 1297 | }
|
1298 | 1298 | ],
|
1299 | 1299 | "source": [
|
1300 |
| - "PlotPercentFreq(high_follower_event_data, 'event_type', title='Percentage Of Event Type Frequency Of High-Follower User', xlim=0.65)" |
| 1300 | + "plot_percent_freq(high_follower_event_data, 'event_type', title='Percentage Of Event Type Frequency Of High-Follower User', xlim=0.65)" |
1301 | 1301 | ]
|
1302 | 1302 | },
|
1303 | 1303 | {
|
|
2351 | 2351 | }
|
2352 | 2352 | ],
|
2353 | 2353 | "source": [
|
2354 |
| - "PlotScatter(df = merged_data, field_x = 'followers', field_y = 'topics', field_type = 'user_type', title = 'Scatter plot between followers and description')" |
| 2354 | + "plot_scatter(df = merged_data, field_x = 'followers', field_y = 'topics', field_type = 'user_type', title = 'Scatter plot between followers and description')" |
2355 | 2355 | ]
|
2356 | 2356 | },
|
2357 | 2357 | {
|
|
2372 | 2372 | }
|
2373 | 2373 | ],
|
2374 | 2374 | "source": [
|
2375 |
| - "PlotScatter(df = merged_data, field_x = 'followers', field_y = 'topics', field_type = 'user_type', title = 'Scatter plot between followers and topics')" |
| 2375 | + "plot_scatter(df = merged_data, field_x = 'followers', field_y = 'topics', field_type = 'user_type', title = 'Scatter plot between followers and topics')" |
2376 | 2376 | ]
|
2377 | 2377 | },
|
2378 | 2378 | {
|
|
2628 | 2628 | }
|
2629 | 2629 | ],
|
2630 | 2630 | "source": [
|
2631 |
| - "PlotScatter(df = merged_data, field_x = 'followers', field_y = 'stargazers_count', field_type = 'user_type', title = 'Scatter plot between followers and stargazers_count')" |
| 2631 | + "plot_scatter(df = merged_data, field_x = 'followers', field_y = 'stargazers_count', field_type = 'user_type', title = 'Scatter plot between followers and stargazers_count')" |
2632 | 2632 | ]
|
2633 | 2633 | },
|
2634 | 2634 | {
|
|
2649 | 2649 | }
|
2650 | 2650 | ],
|
2651 | 2651 | "source": [
|
2652 |
| - "PlotScatter(df = merged_data, field_x = 'followers', field_y = 'forks', field_type = 'user_type', title = 'Scatter plot between followers and forks')" |
| 2652 | + "plot_scatter(df = merged_data, field_x = 'followers', field_y = 'forks', field_type = 'user_type', title = 'Scatter plot between followers and forks')" |
2653 | 2653 | ]
|
2654 | 2654 | },
|
2655 | 2655 | {
|
|
3114 | 3114 | }
|
3115 | 3115 | ],
|
3116 | 3116 | "source": [
|
3117 |
| - "PlotTop10LanguagePercentage(repo_data, title = 'Top 10 Languages by Percentage Across All Users repositories', xlim=50)" |
| 3117 | + "plot_top10_language_percentage(repo_data, title = 'Top 10 Languages by Percentage Across All Users repositories', xlim=50)" |
3118 | 3118 | ]
|
3119 | 3119 | },
|
3120 | 3120 | {
|
|
3135 | 3135 | }
|
3136 | 3136 | ],
|
3137 | 3137 | "source": [
|
3138 |
| - "PlotTop10LanguagePercentage(high_follower_repo_data, title = 'Top 10 Languages by Percentage In High-follower User repositories', xlim=50)" |
| 3138 | + "plot_top10_language_percentage(high_follower_repo_data, title = 'Top 10 Languages by Percentage In High-follower User repositories', xlim=50)" |
3139 | 3139 | ]
|
3140 | 3140 | },
|
3141 | 3141 | {
|
|
3156 | 3156 | }
|
3157 | 3157 | ],
|
3158 | 3158 | "source": [
|
3159 |
| - "PlotTop10LanguagePercentage(low_follower_repo_data, title = 'Top 10 Languages by Percentage In Low-follower User repositories', xlim=50)" |
| 3159 | + "plot_top10_language_percentage(low_follower_repo_data, title = 'Top 10 Languages by Percentage In Low-follower User repositories', xlim=50)" |
3160 | 3160 | ]
|
3161 | 3161 | },
|
3162 | 3162 | {
|
|
3323 | 3323 | }
|
3324 | 3324 | ],
|
3325 | 3325 | "source": [
|
3326 |
| - "PlotTop10LanguagePercentage(starred_data, title = 'Top 10 Languages by Percentage Across All Users starred repositories', xlim=50)" |
| 3326 | + "plot_top10_language_percentage(starred_data, title = 'Top 10 Languages by Percentage Across All Users starred repositories', xlim=50)" |
3327 | 3327 | ]
|
3328 | 3328 | },
|
3329 | 3329 | {
|
|
3344 | 3344 | }
|
3345 | 3345 | ],
|
3346 | 3346 | "source": [
|
3347 |
| - "PlotTop10LanguagePercentage(high_follower_starred_data, title = 'Top 10 Languages by Percentage In High-follower User starred repositories', xlim=50)" |
| 3347 | + "plot_top10_language_percentage(high_follower_starred_data, title = 'Top 10 Languages by Percentage In High-follower User starred repositories', xlim=50)" |
3348 | 3348 | ]
|
3349 | 3349 | },
|
3350 | 3350 | {
|
|
3365 | 3365 | }
|
3366 | 3366 | ],
|
3367 | 3367 | "source": [
|
3368 |
| - "PlotTop10LanguagePercentage(low_follower_starred_data, title = 'Top 10 Languages by Percentage In Low-follower User starred repositories', xlim=50)" |
| 3368 | + "plot_top10_language_percentage(low_follower_starred_data, title = 'Top 10 Languages by Percentage In Low-follower User starred repositories', xlim=50)" |
3369 | 3369 | ]
|
3370 | 3370 | },
|
3371 | 3371 | {
|
|
4011 | 4011 | }
|
4012 | 4012 | ],
|
4013 | 4013 | "source": [
|
4014 |
| - "PlotScatter(df = merged_data, field_x = 'followers', field_y = 'stargazers_count', field_type = 'user_type', title = 'Scatter plot between followers and stargazers_count in starred_data')" |
| 4014 | + "plot_scatter(df = merged_data, field_x = 'followers', field_y = 'stargazers_count', field_type = 'user_type', title = 'Scatter plot between followers and stargazers_count in starred_data')" |
4015 | 4015 | ]
|
4016 | 4016 | },
|
4017 | 4017 | {
|
|
0 commit comments