Best Python code snippet using pytest-benchmark
simplexample.py
Source:simplexample.py
...17 ### Argentina Top 200 Charts18 danceability200 = argentina_top200[['date', 'danceability']]19 danceability200.set_index('date', inplace=True)20 danceability200 = danceability200.dropna()21 danceability200_mean = danceability200.groupby('date').mean()22 23 energy200 = argentina_top200[['date', 'energy']]24 energy200.set_index('date', inplace=True)25 energy200 = energy200.dropna()26 energy200_mean = energy200.groupby('date').mean()27 key200 = argentina_top200[['date', 'key']]28 key200.set_index('date', inplace=True)29 key200 = key200.dropna()30 key200_mean = key200.groupby('date').mean()31 loud200 = argentina_top200[['date', 'loudness']]32 loud200.set_index('date', inplace=True)33 loud200 = loud200.dropna()34 loud200_mean = loud200.groupby('date').mean()35 mode200 = argentina_top200[['date', 'mode']]36 mode200.set_index('date', inplace=True)37 mode200 = mode200.dropna()38 mode200_mean = mode200.groupby('date').mean()39 speech200 = argentina_top200[['date', 'speechiness']]40 speech200.set_index('date', inplace=True)41 speech200 = speech200.dropna()42 speech200_mean = speech200.groupby('date').mean()43 acou200 = argentina_top200[['date', 'acousticness']]44 acou200.set_index('date', inplace=True)45 acou200 = acou200.dropna()46 acou200_mean = acou200.groupby('date').mean()47 instr200 = argentina_top200[['date', 'instrumentalness']]48 instr200.set_index('date', inplace=True)49 instr200 = instr200.dropna()50 instr200_mean = instr200.groupby('date').mean()51 live200 = argentina_top200[['date', 'liveness']]52 live200.set_index('date', inplace=True)53 live200 = live200.dropna()54 live200_mean = live200.groupby('date').mean()55 valence200 = argentina_top200[['date', 'valence']]56 valence200.set_index('date', inplace=True)57 valence200 = valence200.dropna()58 valence200_mean = valence200.groupby('date').mean()59 tempo200 = argentina_top200[['date', 'tempo']]60 tempo200.set_index('date', inplace=True)61 tempo200 = tempo200.dropna()62 tempo200_mean = tempo200.groupby('date').mean()63 duration200 = argentina_top200[['date', 'duration_ms']]64 duration200.set_index('date', inplace=True)65 duration200 = duration200.dropna()66 duration200_mean = duration200.groupby('date').mean()67 x_vals=[danceability200_mean.index, energy200_mean.index,key200_mean.index,loud200_mean.index, mode200_mean.index,speech200_mean.index,acou200_mean.index,instr200_mean.index,live200_mean.index,valence200_mean.index,tempo200_mean.index,duration200_mean.index]68 y_vals=['danceability','energy','key','loudness','mode','speechiness','acousticness','instrumentalness','liveness','valence','tempo','duration_ms']69 return x_vals, y_vals, argentina_top20070def australia():71 # read csv data for each country into associated dataframe72 argentina = pd.read_csv('/workspace/plotyDashWebapp/SpotifyDataAnalysis/home/dash_apps/finished_apps/CSVFile/Australia.csv')73 # drop unnamed column from each dataframe74 argentina = argentina.drop(columns=['Unnamed: 0'])75 argentina['date'] = pd.to_datetime(argentina['date'], format='%Y-%m-%d')76 argentina['year'] = pd.DatetimeIndex(argentina['date']).year77 ## Seasonality in Argentina based on Top 200 and Viral 50 charts respectively78 argentina_top200 = argentina[argentina['chart'] == 'top200']79 argentina_viral50 = argentina[argentina['chart'] == 'viral50']80 ### Argentina Top 200 Charts81 danceability200 = argentina_top200[['date', 'danceability']]82 danceability200.set_index('date', inplace=True)83 danceability200 = danceability200.dropna()84 danceability200_mean = danceability200.groupby('date').mean()85 86 energy200 = argentina_top200[['date', 'energy']]87 energy200.set_index('date', inplace=True)88 energy200 = energy200.dropna()89 energy200_mean = energy200.groupby('date').mean()90 key200 = argentina_top200[['date', 'key']]91 key200.set_index('date', inplace=True)92 key200 = key200.dropna()93 key200_mean = key200.groupby('date').mean()94 loud200 = argentina_top200[['date', 'loudness']]95 loud200.set_index('date', inplace=True)96 loud200 = loud200.dropna()97 loud200_mean = loud200.groupby('date').mean()98 mode200 = argentina_top200[['date', 'mode']]99 mode200.set_index('date', inplace=True)100 mode200 = mode200.dropna()101 mode200_mean = mode200.groupby('date').mean()102 speech200 = argentina_top200[['date', 'speechiness']]103 speech200.set_index('date', inplace=True)104 speech200 = speech200.dropna()105 speech200_mean = speech200.groupby('date').mean()106 acou200 = argentina_top200[['date', 'acousticness']]107 acou200.set_index('date', inplace=True)108 acou200 = acou200.dropna()109 acou200_mean = acou200.groupby('date').mean()110 instr200 = argentina_top200[['date', 'instrumentalness']]111 instr200.set_index('date', inplace=True)112 instr200 = instr200.dropna()113 instr200_mean = instr200.groupby('date').mean()114 live200 = argentina_top200[['date', 'liveness']]115 live200.set_index('date', inplace=True)116 live200 = live200.dropna()117 live200_mean = live200.groupby('date').mean()118 valence200 = argentina_top200[['date', 'valence']]119 valence200.set_index('date', inplace=True)120 valence200 = valence200.dropna()121 valence200_mean = valence200.groupby('date').mean()122 tempo200 = argentina_top200[['date', 'tempo']]123 tempo200.set_index('date', inplace=True)124 tempo200 = tempo200.dropna()125 tempo200_mean = tempo200.groupby('date').mean()126 duration200 = argentina_top200[['date', 'duration_ms']]127 duration200.set_index('date', inplace=True)128 duration200 = duration200.dropna()129 duration200_mean = duration200.groupby('date').mean()130 x_vals=[danceability200_mean.index, energy200_mean.index,key200_mean.index,loud200_mean.index, mode200_mean.index,speech200_mean.index,acou200_mean.index,instr200_mean.index,live200_mean.index,valence200_mean.index,tempo200_mean.index,duration200_mean.index]131 y_vals=['danceability','energy','key','loudness','mode','speechiness','acousticness','instrumentalness','liveness','valence','tempo','duration_ms']132 return x_vals, y_vals, argentina_top200133def england():134 # read csv data for each country into associated dataframe135 argentina = pd.read_csv('/workspace/plotyDashWebapp/SpotifyDataAnalysis/home/dash_apps/finished_apps/CSVFile/England.csv')136 # drop unnamed column from each dataframe137 argentina = argentina.drop(columns=['Unnamed: 0'])138 argentina['date'] = pd.to_datetime(argentina['date'], format='%Y-%m-%d')139 argentina['year'] = pd.DatetimeIndex(argentina['date']).year140 ## Seasonality in Argentina based on Top 200 and Viral 50 charts respectively141 argentina_top200 = argentina[argentina['chart'] == 'top200']142 argentina_viral50 = argentina[argentina['chart'] == 'viral50']143 ### Argentina Top 200 Charts144 danceability200 = argentina_top200[['date', 'danceability']]145 danceability200.set_index('date', inplace=True)146 danceability200 = danceability200.dropna()147 danceability200_mean = danceability200.groupby('date').mean()148 149 energy200 = argentina_top200[['date', 'energy']]150 energy200.set_index('date', inplace=True)151 energy200 = energy200.dropna()152 energy200_mean = energy200.groupby('date').mean()153 key200 = argentina_top200[['date', 'key']]154 key200.set_index('date', inplace=True)155 key200 = key200.dropna()156 key200_mean = key200.groupby('date').mean()157 loud200 = argentina_top200[['date', 'loudness']]158 loud200.set_index('date', inplace=True)159 loud200 = loud200.dropna()160 loud200_mean = loud200.groupby('date').mean()161 mode200 = argentina_top200[['date', 'mode']]162 mode200.set_index('date', inplace=True)163 mode200 = mode200.dropna()164 mode200_mean = mode200.groupby('date').mean()165 speech200 = argentina_top200[['date', 'speechiness']]166 speech200.set_index('date', inplace=True)167 speech200 = speech200.dropna()168 speech200_mean = speech200.groupby('date').mean()169 acou200 = argentina_top200[['date', 'acousticness']]170 acou200.set_index('date', inplace=True)171 acou200 = acou200.dropna()172 acou200_mean = acou200.groupby('date').mean()173 instr200 = argentina_top200[['date', 'instrumentalness']]174 instr200.set_index('date', inplace=True)175 instr200 = instr200.dropna()176 instr200_mean = instr200.groupby('date').mean()177 live200 = argentina_top200[['date', 'liveness']]178 live200.set_index('date', inplace=True)179 live200 = live200.dropna()180 live200_mean = live200.groupby('date').mean()181 valence200 = argentina_top200[['date', 'valence']]182 valence200.set_index('date', inplace=True)183 valence200 = valence200.dropna()184 valence200_mean = valence200.groupby('date').mean()185 tempo200 = argentina_top200[['date', 'tempo']]186 tempo200.set_index('date', inplace=True)187 tempo200 = tempo200.dropna()188 tempo200_mean = tempo200.groupby('date').mean()189 duration200 = argentina_top200[['date', 'duration_ms']]190 duration200.set_index('date', inplace=True)191 duration200 = duration200.dropna()192 duration200_mean = duration200.groupby('date').mean()193 x_vals=[danceability200_mean.index, energy200_mean.index,key200_mean.index,loud200_mean.index, mode200_mean.index,speech200_mean.index,acou200_mean.index,instr200_mean.index,live200_mean.index,valence200_mean.index,tempo200_mean.index,duration200_mean.index]194 y_vals=['danceability','energy','key','loudness','mode','speechiness','acousticness','instrumentalness','liveness','valence','tempo','duration_ms']195 return x_vals, y_vals, argentina_top200196def usa():197 # read csv data for each country into associated dataframe198 argentina = pd.read_csv('/workspace/plotyDashWebapp/SpotifyDataAnalysis/home/dash_apps/finished_apps/CSVFile/USA.csv')199 # drop unnamed column from each dataframe200 argentina = argentina.drop(columns=['Unnamed: 0'])201 argentina['date'] = pd.to_datetime(argentina['date'], format='%Y-%m-%d')202 argentina['year'] = pd.DatetimeIndex(argentina['date']).year203 ## Seasonality in Argentina based on Top 200 and Viral 50 charts respectively204 argentina_top200 = argentina[argentina['chart'] == 'top200']205 argentina_viral50 = argentina[argentina['chart'] == 'viral50']206 ### Argentina Top 200 Charts207 danceability200 = argentina_top200[['date', 'danceability']]208 danceability200.set_index('date', inplace=True)209 danceability200 = danceability200.dropna()210 danceability200_mean = danceability200.groupby('date').mean()211 212 energy200 = argentina_top200[['date', 'energy']]213 energy200.set_index('date', inplace=True)214 energy200 = energy200.dropna()215 energy200_mean = energy200.groupby('date').mean()216 key200 = argentina_top200[['date', 'key']]217 key200.set_index('date', inplace=True)218 key200 = key200.dropna()219 key200_mean = key200.groupby('date').mean()220 loud200 = argentina_top200[['date', 'loudness']]221 loud200.set_index('date', inplace=True)222 loud200 = loud200.dropna()223 loud200_mean = loud200.groupby('date').mean()224 mode200 = argentina_top200[['date', 'mode']]225 mode200.set_index('date', inplace=True)226 mode200 = mode200.dropna()227 mode200_mean = mode200.groupby('date').mean()228 speech200 = argentina_top200[['date', 'speechiness']]229 speech200.set_index('date', inplace=True)230 speech200 = speech200.dropna()231 speech200_mean = speech200.groupby('date').mean()232 acou200 = argentina_top200[['date', 'acousticness']]233 acou200.set_index('date', inplace=True)234 acou200 = acou200.dropna()235 acou200_mean = acou200.groupby('date').mean()236 instr200 = argentina_top200[['date', 'instrumentalness']]237 instr200.set_index('date', inplace=True)238 instr200 = instr200.dropna()239 instr200_mean = instr200.groupby('date').mean()240 live200 = argentina_top200[['date', 'liveness']]241 live200.set_index('date', inplace=True)242 live200 = live200.dropna()243 live200_mean = live200.groupby('date').mean()244 valence200 = argentina_top200[['date', 'valence']]245 valence200.set_index('date', inplace=True)246 valence200 = valence200.dropna()247 valence200_mean = valence200.groupby('date').mean()248 tempo200 = argentina_top200[['date', 'tempo']]249 tempo200.set_index('date', inplace=True)250 tempo200 = tempo200.dropna()251 tempo200_mean = tempo200.groupby('date').mean()252 duration200 = argentina_top200[['date', 'duration_ms']]253 duration200.set_index('date', inplace=True)254 duration200 = duration200.dropna()255 duration200_mean = duration200.groupby('date').mean()256 x_vals=[danceability200_mean.index, energy200_mean.index,key200_mean.index,loud200_mean.index, mode200_mean.index,speech200_mean.index,acou200_mean.index,instr200_mean.index,live200_mean.index,valence200_mean.index,tempo200_mean.index,duration200_mean.index]257 y_vals=['danceability','energy','key','loudness','mode','speechiness','acousticness','instrumentalness','liveness','valence','tempo','duration_ms']258 return x_vals, y_vals, argentina_top200259def mexico():260 # read csv data for each country into associated dataframe261 argentina = pd.read_csv('/workspace/plotyDashWebapp/SpotifyDataAnalysis/home/dash_apps/finished_apps/CSVFile/Mexico.csv')262 # drop unnamed column from each dataframe263 argentina = argentina.drop(columns=['Unnamed: 0'])264 argentina['date'] = pd.to_datetime(argentina['date'], format='%Y-%m-%d')265 argentina['year'] = pd.DatetimeIndex(argentina['date']).year266 ## Seasonality in Argentina based on Top 200 and Viral 50 charts respectively267 argentina_top200 = argentina[argentina['chart'] == 'top200']268 argentina_viral50 = argentina[argentina['chart'] == 'viral50']269 ### Argentina Top 200 Charts270 danceability200 = argentina_top200[['date', 'danceability']]271 danceability200.set_index('date', inplace=True)272 danceability200 = danceability200.dropna()273 danceability200_mean = danceability200.groupby('date').mean()274 275 energy200 = argentina_top200[['date', 'energy']]276 energy200.set_index('date', inplace=True)277 energy200 = energy200.dropna()278 energy200_mean = energy200.groupby('date').mean()279 key200 = argentina_top200[['date', 'key']]280 key200.set_index('date', inplace=True)281 key200 = key200.dropna()282 key200_mean = key200.groupby('date').mean()283 loud200 = argentina_top200[['date', 'loudness']]284 loud200.set_index('date', inplace=True)285 loud200 = loud200.dropna()286 loud200_mean = loud200.groupby('date').mean()287 mode200 = argentina_top200[['date', 'mode']]288 mode200.set_index('date', inplace=True)289 mode200 = mode200.dropna()290 mode200_mean = mode200.groupby('date').mean()291 speech200 = argentina_top200[['date', 'speechiness']]292 speech200.set_index('date', inplace=True)293 speech200 = speech200.dropna()294 speech200_mean = speech200.groupby('date').mean()295 acou200 = argentina_top200[['date', 'acousticness']]296 acou200.set_index('date', inplace=True)297 acou200 = acou200.dropna()298 acou200_mean = acou200.groupby('date').mean()299 instr200 = argentina_top200[['date', 'instrumentalness']]300 instr200.set_index('date', inplace=True)301 instr200 = instr200.dropna()302 instr200_mean = instr200.groupby('date').mean()303 live200 = argentina_top200[['date', 'liveness']]304 live200.set_index('date', inplace=True)305 live200 = live200.dropna()306 live200_mean = live200.groupby('date').mean()307 valence200 = argentina_top200[['date', 'valence']]308 valence200.set_index('date', inplace=True)309 valence200 = valence200.dropna()310 valence200_mean = valence200.groupby('date').mean()311 tempo200 = argentina_top200[['date', 'tempo']]312 tempo200.set_index('date', inplace=True)313 tempo200 = tempo200.dropna()314 tempo200_mean = tempo200.groupby('date').mean()315 duration200 = argentina_top200[['date', 'duration_ms']]316 duration200.set_index('date', inplace=True)317 duration200 = duration200.dropna()318 duration200_mean = duration200.groupby('date').mean()319 x_vals=[danceability200_mean.index, energy200_mean.index,key200_mean.index,loud200_mean.index, mode200_mean.index,speech200_mean.index,acou200_mean.index,instr200_mean.index,live200_mean.index,valence200_mean.index,tempo200_mean.index,duration200_mean.index]320 y_vals=['danceability','energy','key','loudness','mode','speechiness','acousticness','instrumentalness','liveness','valence','tempo','duration_ms']321 return x_vals, y_vals, argentina_top200322def spain():323 # read csv data for each country into associated dataframe324 argentina = pd.read_csv('/workspace/plotyDashWebapp/SpotifyDataAnalysis/home/dash_apps/finished_apps/CSVFile/Spain.csv')325 # drop unnamed column from each dataframe326 argentina = argentina.drop(columns=['Unnamed: 0'])327 argentina['date'] = pd.to_datetime(argentina['date'], format='%Y-%m-%d')328 argentina['year'] = pd.DatetimeIndex(argentina['date']).year329 ## Seasonality in Argentina based on Top 200 and Viral 50 charts respectively330 argentina_top200 = argentina[argentina['chart'] == 'top200']331 argentina_viral50 = argentina[argentina['chart'] == 'viral50']332 ### Argentina Top 200 Charts333 danceability200 = argentina_top200[['date', 'danceability']]334 danceability200.set_index('date', inplace=True)335 danceability200 = danceability200.dropna()336 danceability200_mean = danceability200.groupby('date').mean()337 338 energy200 = argentina_top200[['date', 'energy']]339 energy200.set_index('date', inplace=True)340 energy200 = energy200.dropna()341 energy200_mean = energy200.groupby('date').mean()342 key200 = argentina_top200[['date', 'key']]343 key200.set_index('date', inplace=True)344 key200 = key200.dropna()345 key200_mean = key200.groupby('date').mean()346 loud200 = argentina_top200[['date', 'loudness']]347 loud200.set_index('date', inplace=True)348 loud200 = loud200.dropna()349 loud200_mean = loud200.groupby('date').mean()350 mode200 = argentina_top200[['date', 'mode']]351 mode200.set_index('date', inplace=True)352 mode200 = mode200.dropna()353 mode200_mean = mode200.groupby('date').mean()354 speech200 = argentina_top200[['date', 'speechiness']]355 speech200.set_index('date', inplace=True)356 speech200 = speech200.dropna()357 speech200_mean = speech200.groupby('date').mean()358 acou200 = argentina_top200[['date', 'acousticness']]359 acou200.set_index('date', inplace=True)360 acou200 = acou200.dropna()361 acou200_mean = acou200.groupby('date').mean()362 instr200 = argentina_top200[['date', 'instrumentalness']]363 instr200.set_index('date', inplace=True)364 instr200 = instr200.dropna()365 instr200_mean = instr200.groupby('date').mean()366 live200 = argentina_top200[['date', 'liveness']]367 live200.set_index('date', inplace=True)368 live200 = live200.dropna()369 live200_mean = live200.groupby('date').mean()370 valence200 = argentina_top200[['date', 'valence']]371 valence200.set_index('date', inplace=True)372 valence200 = valence200.dropna()373 valence200_mean = valence200.groupby('date').mean()374 tempo200 = argentina_top200[['date', 'tempo']]375 tempo200.set_index('date', inplace=True)376 tempo200 = tempo200.dropna()377 tempo200_mean = tempo200.groupby('date').mean()378 duration200 = argentina_top200[['date', 'duration_ms']]379 duration200.set_index('date', inplace=True)380 duration200 = duration200.dropna()381 duration200_mean = duration200.groupby('date').mean()382 x_vals=[danceability200_mean.index, energy200_mean.index,key200_mean.index,loud200_mean.index, mode200_mean.index,speech200_mean.index,acou200_mean.index,instr200_mean.index,live200_mean.index,valence200_mean.index,tempo200_mean.index,duration200_mean.index]383 y_vals=['danceability','energy','key','loudness','mode','speechiness','acousticness','instrumentalness','liveness','valence','tempo','duration_ms']...
jquery.meanmenu.js
Source:jquery.meanmenu.js
1/*!2* jQuery meanMenu v2.0.83* @Copyright (C) 2012-2014 Chris Wharton @ MeanThemes (https://github.com/meanthemes/meanMenu)4*5*/6/*7* This program is free software: you can redistribute it and/or modify8* it under the terms of the GNU General Public License as published by9* the Free Software Foundation, either version 3 of the License, or10* (at your option) any later version.11*12* THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT13* HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,14* INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR15* FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE16* OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,17* COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.COPYRIGHT HOLDERS WILL NOT18* BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL19* DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.20*21* You should have received a copy of the GNU General Public License22* along with this program. If not, see <http://gnu.org/licenses/>.23*24* Find more information at http://www.meanthemes.com/plugins/meanmenu/25*26*/27(function ($) {28 "use strict";29 $.fn.meanmenu = function (options) {30 var defaults = {31 meanMenuTarget: jQuery(this), // Target the current HTML markup you wish to replace32 meanMenuContainer: '.mobile-menu-area .container', // Choose where meanmenu will be placed within the HTML33 meanMenuClose: "X", // single character you want to represent the close menu button34 meanMenuCloseSize: "18px", // set font size of close button35 meanMenuOpen: "<span /><span /><span />", // text/markup you want when menu is closed36 meanRevealPosition: "right", // left right or center positions37 meanRevealPositionDistance: "0", // Tweak the position of the menu38 meanRevealColour: "", // override CSS colours for the reveal background39 meanScreenWidth: "767", // set the screen width you want meanmenu to kick in at40 meanNavPush: "", // set a height here in px, em or % if you want to budge your layout now the navigation is missing.41 meanShowChildren: true, // true to show children in the menu, false to hide them42 meanExpandableChildren: true, // true to allow expand/collapse children43 meanExpand: "+", // single character you want to represent the expand for ULs44 meanContract: "-", // single character you want to represent the contract for ULs45 meanRemoveAttrs: false, // true to remove classes and IDs, false to keep them46 onePage: false, // set to true for one page sites47 meanDisplay: "block", // override display method for table cell based layouts e.g. table-cell48 removeElements: "" // set to hide page elements49 };50 options = $.extend(defaults, options);51 // get browser width52 var currentWidth = window.innerWidth || document.documentElement.clientWidth;53 return this.each(function () {54 var meanMenu = options.meanMenuTarget;55 var meanContainer = options.meanMenuContainer;56 var meanMenuClose = options.meanMenuClose;57 var meanMenuCloseSize = options.meanMenuCloseSize;58 var meanMenuOpen = options.meanMenuOpen;59 var meanRevealPosition = options.meanRevealPosition;60 var meanRevealPositionDistance = options.meanRevealPositionDistance;61 var meanRevealColour = options.meanRevealColour;62 var meanScreenWidth = options.meanScreenWidth;63 var meanNavPush = options.meanNavPush;64 var meanRevealClass = ".meanmenu-reveal";65 var meanShowChildren = options.meanShowChildren;66 var meanExpandableChildren = options.meanExpandableChildren;67 var meanExpand = options.meanExpand;68 var meanContract = options.meanContract;69 var meanRemoveAttrs = options.meanRemoveAttrs;70 var onePage = options.onePage;71 var meanDisplay = options.meanDisplay;72 var removeElements = options.removeElements;73 //detect known mobile/tablet usage74 var isMobile = false;75 if ( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/Android/i)) || (navigator.userAgent.match(/Blackberry/i)) || (navigator.userAgent.match(/Windows Phone/i)) ) {76 isMobile = true;77 }78 if ( (navigator.userAgent.match(/MSIE 8/i)) || (navigator.userAgent.match(/MSIE 7/i)) ) {79 // add scrollbar for IE7 & 8 to stop breaking resize function on small content sites80 jQuery('html').css("overflow-y" , "scroll");81 }82 var meanRevealPos = "";83 var meanCentered = function() {84 if (meanRevealPosition === "center") {85 var newWidth = window.innerWidth || document.documentElement.clientWidth;86 var meanCenter = ( (newWidth/2)-22 )+"px";87 meanRevealPos = "left:" + meanCenter + ";right:auto;";88 if (!isMobile) {89 jQuery('.meanmenu-reveal').css("left",meanCenter);90 } else {91 jQuery('.meanmenu-reveal').animate({92 left: meanCenter93 });94 }95 }96 };97 var menuOn = false;98 var meanMenuExist = false;99 if (meanRevealPosition === "right") {100 meanRevealPos = "right:" + meanRevealPositionDistance + ";left:auto;";101 }102 if (meanRevealPosition === "left") {103 meanRevealPos = "left:" + meanRevealPositionDistance + ";right:auto;";104 }105 // run center function106 meanCentered();107 // set all styles for mean-reveal108 var $navreveal = "";109 var meanInner = function() {110 // get last class name111 if (jQuery($navreveal).is(".meanmenu-reveal.meanclose")) {112 $navreveal.html(meanMenuClose);113 } else {114 $navreveal.html(meanMenuOpen);115 }116 };117 // re-instate original nav (and call this on window.width functions)118 var meanOriginal = function() {119 jQuery('.mean-bar,.mean-push').remove();120 jQuery(meanContainer).removeClass("mean-container");121 jQuery(meanMenu).css('display', meanDisplay);122 menuOn = false;123 meanMenuExist = false;124 jQuery(removeElements).removeClass('mean-remove');125 };126 // navigation reveal127 var showMeanMenu = function() {128 var meanStyles = "background:"+meanRevealColour+";color:"+meanRevealColour+";"+meanRevealPos;129 if (currentWidth <= meanScreenWidth) {130 jQuery(removeElements).addClass('mean-remove');131 meanMenuExist = true;132 // add class to body so we don't need to worry about media queries here, all CSS is wrapped in '.mean-container'133 jQuery(meanContainer).addClass("mean-container");134 jQuery('.mean-container').prepend('<div class="mean-bar"><a href="#nav" class="meanmenu-reveal" style="'+meanStyles+'">Show Navigation</a><nav class="mean-nav"></nav></div>');135 //push meanMenu navigation into .mean-nav136 var meanMenuContents = jQuery(meanMenu).html();137 jQuery('.mean-nav').html(meanMenuContents);138 // remove all classes from EVERYTHING inside meanmenu nav139 if(meanRemoveAttrs) {140 jQuery('nav.mean-nav ul, nav.mean-nav ul *').each(function() {141 // First check if this has mean-remove class142 if (jQuery(this).is('.mean-remove')) {143 jQuery(this).attr('class', 'mean-remove');144 } else {145 jQuery(this).removeAttr("class");146 }147 jQuery(this).removeAttr("id");148 });149 }150 // push in a holder div (this can be used if removal of nav is causing layout issues)151 jQuery(meanMenu).before('<div class="mean-push" />');152 jQuery('.mean-push').css("margin-top",meanNavPush);153 // hide current navigation and reveal mean nav link154 jQuery(meanMenu).hide();155 jQuery(".meanmenu-reveal").show();156 // turn 'X' on or off157 jQuery(meanRevealClass).html(meanMenuOpen);158 $navreveal = jQuery(meanRevealClass);159 //hide mean-nav ul160 jQuery('.mean-nav ul').hide();161 // hide sub nav162 if(meanShowChildren) {163 // allow expandable sub nav(s)164 if(meanExpandableChildren){165 jQuery('.mean-nav ul ul').each(function() {166 if(jQuery(this).children().length){167 jQuery(this,'li:first').parent().append('<a class="mean-expand" href="#" style="font-size: '+ meanMenuCloseSize +'">'+ meanExpand +'</a>');168 }169 });170 jQuery('.mean-expand').on("click",function(e){171 e.preventDefault();172 if (jQuery(this).hasClass("mean-clicked")) {173 jQuery(this).text(meanExpand);174 jQuery(this).prev('ul').slideUp(300, function(){});175 } else {176 jQuery(this).text(meanContract);177 jQuery(this).prev('ul').slideDown(300, function(){});178 }179 jQuery(this).toggleClass("mean-clicked");180 });181 } else {182 jQuery('.mean-nav ul ul').show();183 }184 } else {185 jQuery('.mean-nav ul ul').hide();186 }187 // add last class to tidy up borders188 jQuery('.mean-nav ul li').last().addClass('mean-last');189 $navreveal.removeClass("meanclose");190 jQuery($navreveal).click(function(e){191 e.preventDefault();192 if( menuOn === false ) {193 $navreveal.css("text-align", "center");194 $navreveal.css("text-indent", "0");195 $navreveal.css("font-size", meanMenuCloseSize);196 jQuery('.mean-nav ul:first').slideDown();197 menuOn = true;198 } else {199 jQuery('.mean-nav ul:first').slideUp();200 menuOn = false;201 }202 $navreveal.toggleClass("meanclose");203 meanInner();204 jQuery(removeElements).addClass('mean-remove');205 });206 // for one page websites, reset all variables...207 if ( onePage ) {208 jQuery('.mean-nav ul > li > a:first-child').on( "click" , function () {209 jQuery('.mean-nav ul:first').slideUp();210 menuOn = false;211 jQuery($navreveal).toggleClass("meanclose").html(meanMenuOpen);212 });213 }214 } else {215 meanOriginal();216 }217 };218 if (!isMobile) {219 // reset menu on resize above meanScreenWidth220 jQuery(window).resize(function () {221 currentWidth = window.innerWidth || document.documentElement.clientWidth;222 if (currentWidth > meanScreenWidth) {223 meanOriginal();224 } else {225 meanOriginal();226 }227 if (currentWidth <= meanScreenWidth) {228 showMeanMenu();229 meanCentered();230 } else {231 meanOriginal();232 }233 });234 }235 jQuery(window).resize(function () {236 // get browser width237 currentWidth = window.innerWidth || document.documentElement.clientWidth;238 if (!isMobile) {239 meanOriginal();240 if (currentWidth <= meanScreenWidth) {241 showMeanMenu();242 meanCentered();243 }244 } else {245 meanCentered();246 if (currentWidth <= meanScreenWidth) {247 if (meanMenuExist === false) {248 showMeanMenu();249 }250 } else {251 meanOriginal();252 }253 }254 });255 // run main menuMenu function on load256 showMeanMenu();257 });258 };259 260 /*--261 Mobile Menu262 ------------------------*/263 $('.mobile-menu nav').meanmenu({264 meanScreenWidth: "990",265 meanMenuContainer: ".mobile-menu",266 onePage: false,267 }); 268 ...
z-score.py
Source:z-score.py
...1213## code to find the mean of 100 data points 1000 times 14#function to get the mean of the given data samples15# pass the number of data points you want as counter16def random_set_of_mean(counter):17 dataset = []18 for i in range(0, counter):19 random_index= random.randint(0,len(data)-1)20 value = data[random_index]21 dataset.append(value)22 mean = statistics.mean(dataset)23 return mean242526# Function to get the mean of 100 data sets27mean_list = []28for i in range(0,1000):29 set_of_means= random_set_of_mean(100)30 mean_list.append(set_of_means)313233## calculating mean and standard_deviation of the sampling distribution.34std_deviation = statistics.stdev(mean_list)35mean = statistics.mean(mean_list)36print("mean of sampling distribution:- ",mean)37print("Standard deviation of sampling distribution:- ", std_deviation)38394041## findig the standard deviation starting and ending values42first_std_deviation_start, first_std_deviation_end = mean-std_deviation, mean+std_deviation43second_std_deviation_start, second_std_deviation_end = mean-(2*std_deviation), mean+(2*std_deviation)44third_std_deviation_start, third_std_deviation_end = mean-(3*std_deviation), mean+(3*std_deviation)45# print("std1",first_std_deviation_start, first_std_deviation_end)46# print("std2",second_std_deviation_start, second_std_deviation_end)47# print("std3",third_std_deviation_start,third_std_deviation_end)4849505152# # finding the mean of THE STUDENTS WHO GAVE EXTRA TIME TO MATH LAB and plotting on graph53df = pd.read_csv("School_1_Sample.csv")54data = df["Math_score"].tolist()55mean_of_sample1 = statistics.mean(data)56print("Mean of sample1:- ",mean_of_sample1)57fig = ff.create_distplot([mean_list], ["student marks"], show_hist=False)58fig.add_trace(go.Scatter(x=[mean, mean], y=[0, 0.17], mode="lines", name="MEAN"))59fig.add_trace(go.Scatter(x=[mean_of_sample1, mean_of_sample1], y=[0, 0.17], mode="lines", name="MEAN OF STUDENTS WHO HAD MATH LABS"))60fig.add_trace(go.Scatter(x=[first_std_deviation_end, first_std_deviation_end], y=[0, 0.17], mode="lines", name="STANDARD DEVIATION 1 END"))61fig.add_trace(go.Scatter(x=[second_std_deviation_end, second_std_deviation_end], y=[0, 0.17], mode="lines", name="STANDARD DEVIATION 2 END"))62fig.add_trace(go.Scatter(x=[third_std_deviation_end, third_std_deviation_end], y=[0, 0.17], mode="lines", name="STANDARD DEVIATION 3 END"))63fig.show()6465666768# #finding the mean of the STUDENTS WHO USED MATH PRACTISE APP and plotting it on the plot.69df = pd.read_csv("School_2_Sample.csv")70data = df["Math_score"].tolist()71mean_of_sample2 = statistics.mean(data)72print("mean of sample 2:- ",mean_of_sample2)73fig = ff.create_distplot([mean_list], ["student marks"], show_hist=False)74fig.add_trace(go.Scatter(x=[mean, mean], y=[0, 0.17], mode="lines", name="MEAN"))75fig.add_trace(go.Scatter(x=[mean_of_sample2, mean_of_sample2], y=[0, 0.17], mode="lines", name="MEAN OF STUDENTS WHO USED THE APP"))76fig.add_trace(go.Scatter(x=[first_std_deviation_end, first_std_deviation_end], y=[0, 0.17], mode="lines", name="STANDARD DEVIATION 1 END"))77fig.add_trace(go.Scatter(x=[second_std_deviation_end, second_std_deviation_end], y=[0, 0.17], mode="lines", name="STANDARD DEVIATION 2 END"))78fig.add_trace(go.Scatter(x=[third_std_deviation_end, third_std_deviation_end], y=[0, 0.17], mode="lines", name="STANDARD DEVIATION 3 END"))79fig.show()808182# finding the mean of the STUDENTS WHO WERE ENFORCED WITH REGISTERS and plotting it on the plot.83df = pd.read_csv("School_3_Sample.csv")84data = df["Math_score"].tolist()85mean_of_sample3 = statistics.mean(data)86print("mean of sample3:- ",mean_of_sample3)87fig = ff.create_distplot([mean_list], ["student marks"], show_hist=False)88fig.add_trace(go.Scatter(x=[mean, mean], y=[0, 0.17], mode="lines", name="MEAN"))89fig.add_trace(go.Scatter(x=[mean_of_sample3, mean_of_sample3], y=[0, 0.17], mode="lines", name="MEAN OF STUDNETS WHO WERE ENFORCED WITH MATH REGISTERS"))90fig.add_trace(go.Scatter(x=[second_std_deviation_end, second_std_deviation_end], y=[0, 0.17], mode="lines", name="STANDARD DEVIATION 2 END"))91fig.add_trace(go.Scatter(x=[third_std_deviation_end, third_std_deviation_end], y=[0, 0.17], mode="lines", name="STANDARD DEVIATION 3 END"))92fig.show()939495#finding the z score 96z_score = (mean - mean_of_sample2)/std_deviation
...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!