diff --git a/.travis.yml b/.travis.yml index ed1d8b9..ea494de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: python -dist: trusty +dist: bionic script: - python setup.py test @@ -18,7 +18,8 @@ branches: python: - "2.7" - - "3.3" - - "3.4" - "3.5" - - "3.6-dev" + - "3.6" + - "3.7" + - "3.8" + - "3.9" diff --git a/binpacking/utilities.py b/binpacking/utilities.py index 1b16ff2..22b8a34 100644 --- a/binpacking/utilities.py +++ b/binpacking/utilities.py @@ -8,34 +8,34 @@ def load_csv(filepath,weight_column,has_header=False,delim=',',quotechar='"'): + weight_col_is_str = isinstance(weight_column,basestring) + + if weight_col_is_str and not has_header: + raise Exception("weight key "+weight_column+" useless, since given csv has no header") + with open(filepath) as csvfile: reader = csv.reader(csvfile, delimiter=delim, quotechar=quotechar) data = [] row_count = 0 header = None - + for row in reader: - if row_count>0: - row[weight_column] = float(row[weight_column]) - data.append(row) - elif has_header: + if has_header and row_count == 0: header = row - if isinstance(weight_column,basestring): - if has_header: - if weight_column in header: - weight_column = header.index(weight_column) - else: - raise Exception("weight key "+weight_column+" not found in header") + if weight_column in header: + weight_column = header.index(weight_column) + else: + raise Exception("weight key "+weight_column+" not found in header") else: - if isinstance(weight_column,basestring): - raise Exception("weight key "+weight_column+" useless, since given csv has no header") + row[weight_column] = float(row[weight_column]) + data.append(row) row_count += 1 - return data,weight_column,header + return data, weight_column, header def print_binsizes(bins,weight_column): @@ -43,7 +43,6 @@ def print_binsizes(bins,weight_column): formatstr = "%0" + str(len(str(len(bins)-1))) + "d" for ib,b in enumerate(bins): print(formatstr % ib, sum([t[weight_column] for t in b])) - def save_csvs(bins,filepath,header,delim=',',quotechar='"'): filename, file_extension = os.path.splitext(filepath) @@ -52,7 +51,7 @@ def save_csvs(bins,filepath,header,delim=',',quotechar='"'): for ib,b in enumerate(bins): current_path = filename + "_" + formatstr % ib + file_extension - with open(current_path,"w") as csvfile: + with open(current_path,"w") as csvfile: writer = csv.writer(csvfile, delimiter=delim, quotechar=quotechar, quoting=csv.QUOTE_MINIMAL) if header is not None: writer.writerow(header) diff --git a/examples/hamlet_word_count_00.csv b/examples/hamlet_word_count_00.csv index d4b4112..3796dfc 100644 --- a/examples/hamlet_word_count_00.csv +++ b/examples/hamlet_word_count_00.csv @@ -1,97 +1,5 @@ -the,1206.0 -we,151.0 -from,107.0 -let,92.0 -would,78.0 -give,65.0 -an,59.0 -one,55.0 -ros,53.0 -horatio,43.0 -take,38.0 -polonius,35.0 -within,32.0 -nothing,30.0 -been,28.0 -away,26.0 -comes,24.0 -about,22.0 -done,21.0 -means,21.0 -keep,19.0 -form,18.0 -once,17.0 -is't,16.0 -thoughts,16.0 -etexts,15.0 -grief,14.0 -welcome,14.0 -duty,13.0 -grace,13.0 -awhile,12.0 -thousand,12.0 -neither,11.0 -through,11.0 -villain,11.0 -full,11.0 -passion,11.0 -let's,10.0 -arms,9.0 -behind,9.0 -falls,9.0 -aside,9.0 -shows,9.0 -understand,8.0 -says,8.0 -wrong,8.0 -hope,8.0 -return,8.0 -brother's,7.0 -beseech,7.0 -shot,7.0 -loves,7.0 -fool,7.0 -sorrow,6.0 -cornelius,6.0 -ambition,6.0 -double,6.0 -cold,6.0 -gifts,6.0 -danish,6.0 -ii,6.0 -struck,6.0 -stir,5.0 -statement,5.0 -souls,5.0 -among,5.0 -man's,5.0 -present,5.0 -liberty,5.0 -blessing,5.0 -marriage,5.0 -flesh,5.0 -burial,5.0 -prologue,5.0 -safety,5.0 -flourish,5.0 -servant,5.0 -request,4.0 -breathe,4.0 -favour,4.0 -forget,4.0 -reach,4.0 -hecuba,4.0 -hence,4.0 -twice,4.0 -legal,4.0 -rose,4.0 -b',4.0 -didst,4.0 -past,4.0 -possible,4.0 -certain,4.0 -william,4.0 -lives,4.0 -hundred,4.0 -hall,4.0 -ye,4.0 +word,count +to,797.0 +of,732.0 +in,444.0 +pray,27.0 diff --git a/examples/hamlet_word_count_01.csv b/examples/hamlet_word_count_01.csv index f744620..b0671ad 100644 --- a/examples/hamlet_word_count_01.csv +++ b/examples/hamlet_word_count_01.csv @@ -1,98 +1,5 @@ -and,1005.0 -he,212.0 -are,141.0 -o,104.0 -at,97.0 -there,74.0 -enter,66.0 -should,59.0 -am,55.0 -man,51.0 -had,44.0 -own,39.0 -guil,35.0 -mine,32.0 -again,30.0 -pray,27.0 -any,26.0 -nay,25.0 -call,22.0 -players,21.0 -son,21.0 -hand,19.0 -thing,18.0 -ear,17.0 -question,16.0 -majesty,16.0 -between,15.0 -o'er,14.0 -another,14.0 -spirit,13.0 -gentleman,13.0 -hands,12.0 -second,12.0 -men,11.0 -name,11.0 -takes,11.0 -fire,11.0 -fine,10.0 -peace,10.0 -doubt,10.0 -fall,9.0 -strange,9.0 -note,9.0 -offence,9.0 -back,8.0 -wife,8.0 -to't,8.0 -shame,8.0 -sit,8.0 -public,7.0 -already,7.0 -woman,7.0 -next,7.0 -husband,7.0 -reynaldo,6.0 -information,6.0 -re-enter,6.0 -feed,6.0 -wouldst,6.0 -dare,6.0 -beauty,6.0 -prince,6.0 -confess,6.0 -house,5.0 -sudden,5.0 -slain,5.0 -withal,5.0 -'gainst,5.0 -perhaps,5.0 -property,5.0 -author,5.0 -cry,5.0 -mass,5.0 -player,5.0 -damages,5.0 -university,5.0 -received,5.0 -drown'd,5.0 -expense,4.0 -remembrance,4.0 -poison'd,4.0 -armed,4.0 -spade,4.0 -turn'd,4.0 -wild,4.0 -habit,4.0 -begun,4.0 -fort,4.0 -honour'd,4.0 -length,4.0 -four,4.0 -so',4.0 -forgot,4.0 -wi',4.0 -sorry,4.0 -flowers,4.0 -lights,4.0 -unnatural,4.0 +word,count +you,592.0 +a,563.0 +i,541.0 +his,297.0 diff --git a/examples/hamlet_word_count_02.csv b/examples/hamlet_word_count_02.csv index 4417ff6..72e2485 100644 --- a/examples/hamlet_word_count_02.csv +++ b/examples/hamlet_word_count_02.csv @@ -1,99 +1,7 @@ -to,797.0 -for,269.0 -so,197.0 -if,131.0 -hamlet,102.0 -pol,86.0 -well,71.0 -very,65.0 -i'll,56.0 -say,53.0 -see,48.0 -can,39.0 -nor,38.0 -etext,34.0 -night,31.0 -both,29.0 -sweet,26.0 -great,26.0 -set,24.0 -i',22.0 -ber,21.0 -words,20.0 -use,20.0 -little,18.0 -please,17.0 -youth,16.0 -last,16.0 -live,15.0 -mark,14.0 -work,14.0 -kind,13.0 -we'll,13.0 -help,12.0 -drink,12.0 -revenge,11.0 -he's,11.0 -bed,11.0 -fortune,11.0 -deed,10.0 -aught,10.0 -phrase,10.0 -swear,9.0 -walk,9.0 -bernardo,9.0 -letters,9.0 -fran,8.0 -list,8.0 -power,8.0 -law,8.0 -looks,8.0 -needs,7.0 -rank,7.0 -dies,7.0 -service,7.0 -water,6.0 -fault,6.0 -others,6.0 -shape,6.0 -choose,6.0 -health,6.0 -copy,6.0 -buried,6.0 -hot,6.0 -bad,6.0 -heavy,6.0 -sing,5.0 -knew,5.0 -france,5.0 -ten,5.0 -slave,5.0 -patience,5.0 -bodies,5.0 -spirits,5.0 -fortune's,5.0 -million,5.0 -wit,5.0 -beard,5.0 -terms,5.0 -brains,5.0 -freely,4.0 -pate,4.0 -tale,4.0 -pleasure,4.0 -mock,4.0 -fast,4.0 -cries,4.0 -wear,4.0 -motion,4.0 -stars,4.0 -stronger,4.0 -modesty,4.0 -fingers,4.0 -sigh,4.0 -thrice,4.0 -thence,4.0 -reads,4.0 -months,4.0 -directly,4.0 -ass,4.0 +word,count +my,513.0 +it,428.0 +that,391.0 +is,359.0 +with,274.0 +ay,35.0 diff --git a/examples/hamlet_word_count_03.csv b/examples/hamlet_word_count_03.csv index b11d123..073c2ae 100644 --- a/examples/hamlet_word_count_03.csv +++ b/examples/hamlet_word_count_03.csv @@ -1,100 +1,8 @@ -of,732.0 -with,274.0 +word,count +ham,358.0 +this,332.0 +not,319.0 +for,269.0 +but,263.0 +your,252.0 what,201.0 -no,148.0 -hor,111.0 -her,91.0 -know,75.0 -love,66.0 -why,60.0 -upon,55.0 -father,51.0 -who,44.0 -exit,39.0 -mar,35.0 -dead,32.0 -indeed,30.0 -even,27.0 -head,26.0 -earth,24.0 -those,23.0 -till,21.0 -poor,20.0 -england,20.0 -father's,18.0 -long,17.0 -that's,16.0 -hast,16.0 -rest,15.0 -answer,14.0 -word,14.0 -dost,13.0 -daughter,13.0 -gentlemen,12.0 -right,12.0 -mind,11.0 -thought,11.0 -remember,11.0 -best,11.0 -hamlet's,10.0 -near,10.0 -hell,10.0 -brother,9.0 -less,9.0 -small,9.0 -came,9.0 -soft,8.0 -sun,8.0 -on't,8.0 -break,8.0 -joy,8.0 -coming,7.0 -top,7.0 -wholesome,7.0 -capt,7.0 -laugh,6.0 -stood,6.0 -bid,6.0 -cast,6.0 -whilst,6.0 -wager,6.0 -sister,6.0 -damned,6.0 -brought,6.0 -new,6.0 -toward,6.0 -themselves,5.0 -vows,5.0 -fly,5.0 -christian,5.0 -damn'd,5.0 -hearing,5.0 -went,5.0 -trumpet,5.0 -told,5.0 -in's,5.0 -visage,5.0 -adieu,5.0 -twelve,5.0 -cannon,5.0 -otherwise,4.0 -whereto,4.0 -main,4.0 -bosom,4.0 -calls,4.0 -desires,4.0 -lead,4.0 -shortly,4.0 -white,4.0 -yea,4.0 -return'd,4.0 -consent,4.0 -want,4.0 -anything,4.0 -hang,4.0 -special,4.0 -bestow,4.0 -editions,4.0 -angel,4.0 -if't,3.0 -idle,3.0 diff --git a/examples/hamlet_word_count_04.csv b/examples/hamlet_word_count_04.csv index ea53a35..3779f04 100644 --- a/examples/hamlet_word_count_04.csv +++ b/examples/hamlet_word_count_04.csv @@ -1,101 +1,11 @@ -you,592.0 -his,297.0 +word,count +be,229.0 +me,229.0 +as,224.0 lord,221.0 -or,154.0 -our,131.0 -more,101.0 -may,85.0 -them,72.0 -hath,64.0 -their,57.0 -where,53.0 -time,47.0 -laertes,43.0 -mother,37.0 -ghost,32.0 -whose,31.0 -leave,28.0 -matter,27.0 -world,26.0 -scene,24.0 -before,22.0 -fair,21.0 -fear,20.0 -off,20.0 -blood,18.0 -faith,17.0 -speech,16.0 -therefore,16.0 -things,15.0 -ever,14.0 -gone,14.0 -thine,13.0 -after,13.0 -together,12.0 -saw,12.0 -to-night,11.0 -given,11.0 -business,11.0 -face,11.0 -particular,10.0 -seem,10.0 -lie,10.0 -almost,9.0 -sight,9.0 -action,9.0 -age,9.0 -known,8.0 -osric,8.0 -devil,8.0 -forth,8.0 -wilt,8.0 -print,7.0 -turn,7.0 -desire,7.0 -beg,7.0 -medium,6.0 -laid,6.0 -common,6.0 -files,6.0 -proof,6.0 -rather,6.0 -false,6.0 -lies,6.0 -seal'd,6.0 -home,6.0 -piece,6.0 -holds,5.0 -works,5.0 -morning,5.0 -short,5.0 -star,5.0 -report,5.0 -conceit,5.0 -image,5.0 -shalt,5.0 -distribute,5.0 -dread,5.0 -soldiers,5.0 -gracious,5.0 -complete,4.0 -bones,4.0 -commend,4.0 -chamber,4.0 -paid,4.0 -express,4.0 -lov'd,4.0 -ladies,4.0 -sick,4.0 -wittenberg,4.0 -wide,4.0 -meant,4.0 -pause,4.0 -brief,4.0 -release,4.0 -following,4.0 -kept,4.0 -quality,4.0 -cousin,4.0 -priam,4.0 -good-night,4.0 -bitter,3.0 +he,212.0 +so,197.0 +him,195.0 +king,193.0 +have,185.0 +shall,114.0 diff --git a/examples/hamlet_word_count_05.csv b/examples/hamlet_word_count_05.csv index 4eb383e..c3be5a6 100644 --- a/examples/hamlet_word_count_05.csv +++ b/examples/hamlet_word_count_05.csv @@ -1,101 +1,16 @@ -a,563.0 -not,319.0 -as,224.0 +word,count +will,174.0 do,156.0 +or,154.0 +we,151.0 +no,148.0 +are,141.0 +by,140.0 on,140.0 -now,98.0 -was,83.0 -go,70.0 -must,62.0 -oph,58.0 -than,54.0 -clown,47.0 -heaven,43.0 -exeunt,36.0 -project,33.0 -might,31.0 -dear,28.0 -down,27.0 -never,26.0 -true,23.0 -day,23.0 -mad,21.0 -since,20.0 -friends,19.0 -act,19.0 -else,17.0 -there's,16.0 -watch,15.0 -fortinbras,15.0 -tongue,15.0 -none,13.0 -gertrude,13.0 -haste,13.0 -ho,12.0 -voice,12.0 -fit,12.0 -alas,11.0 -receive,11.0 -far,11.0 -hour,10.0 -skull,10.0 -honour,10.0 -judgment,9.0 -courtier,9.0 -breath,9.0 -noise,8.0 -hither,8.0 -elsinore,8.0 -lost,8.0 -read,8.0 -truly,8.0 -light,8.0 -gives,7.0 -voltimand,7.0 -year,7.0 -mother's,6.0 -guilty,6.0 -circumstance,6.0 -visit,6.0 -whom,6.0 -court,6.0 -truth,6.0 -crown,6.0 -choice,6.0 -kill'd,6.0 -fare,6.0 -whereon,5.0 -commission,5.0 -honesty,5.0 -teach,5.0 -treason,5.0 -longer,5.0 -eat,5.0 -writ,5.0 -motive,5.0 -prison,5.0 -dream,5.0 -mercy,5.0 -th',5.0 -throat,4.0 -prepared,4.0 -deep,4.0 -often,4.0 -treasure,4.0 -remove,4.0 -thrift,4.0 -few,4.0 -cursed,4.0 -incestuous,4.0 -quantity,4.0 -ftp,4.0 -frame,4.0 -leisure,4.0 -fain,4.0 -date,4.0 -addition,4.0 -years,4.0 -puts,4.0 -liability,4.0 -thinking,4.0 -feeling,3.0 +if,131.0 +our,131.0 +all,125.0 +queen,117.0 +hor,111.0 +from,107.0 +there,74.0 diff --git a/examples/hamlet_word_count_06.csv b/examples/hamlet_word_count_06.csv index d57dfc4..79b1ddf 100644 --- a/examples/hamlet_word_count_06.csv +++ b/examples/hamlet_word_count_06.csv @@ -1,101 +1,24 @@ -i,541.0 -this,332.0 -me,229.0 -will,174.0 -queen,117.0 +word,count +o,104.0 +thou,103.0 they,102.0 +hamlet,102.0 +more,101.0 +come,99.0 +good,99.0 +now,98.0 +at,97.0 +let,92.0 +her,91.0 +how,89.0 thy,86.0 -sir,72.0 -laer,62.0 -when,57.0 -out,55.0 -think,47.0 -tell,43.0 -ay,35.0 -soul,34.0 -cannot,30.0 -guildenstern,29.0 -heart,27.0 -hold,26.0 -against,23.0 -seen,22.0 -denmark,22.0 -old,20.0 -gutenberg,19.0 -many,18.0 -art,17.0 -noble,17.0 -castle,15.0 -said,15.0 -sings,14.0 -lady,14.0 -rey,13.0 -norway,13.0 -murder,12.0 -air,12.0 -being,12.0 -sure,11.0 -foul,11.0 -way,11.0 -memory,10.0 -p,10.0 -while,10.0 -every,9.0 -thank,9.0 -person,9.0 -three,8.0 -grow,8.0 -fashion,8.0 -attendants,8.0 -unto,8.0 -conscience,8.0 -obey,7.0 -point,7.0 -seems,7.0 -bloody,7.0 -lose,7.0 -over,6.0 -vile,6.0 -below,6.0 -lack,6.0 -fat,6.0 -move,6.0 -wish,6.0 -domain,6.0 -desperate,6.0 -wicked,6.0 -mortal,5.0 -yes,5.0 -countenance,5.0 -arm,5.0 -table,5.0 -kingdom,5.0 -land,5.0 -beneath,5.0 -nunnery,5.0 -perchance,5.0 -base,5.0 -woul't,5.0 -bound,5.0 -native,4.0 -methought,4.0 -file,4.0 -lands,4.0 -violence,4.0 -tender,4.0 -glad,4.0 -sort,4.0 -polack,4.0 -affair,4.0 -tend,4.0 -defect,4.0 -grows,4.0 -draws,4.0 -pity,4.0 -argument,4.0 -ready,4.0 -warrant,4.0 -iv,4.0 -cost,4.0 -prepare,4.0 -borne,3.0 +pol,86.0 +may,85.0 +most,85.0 +was,83.0 +like,80.0 +would,78.0 +know,75.0 +us,73.0 +them,72.0 +words,20.0 diff --git a/examples/hamlet_word_count_07.csv b/examples/hamlet_word_count_07.csv index e68b790..d3ef96a 100644 --- a/examples/hamlet_word_count_07.csv +++ b/examples/hamlet_word_count_07.csv @@ -1,101 +1,34 @@ -my,513.0 -ham,358.0 -be,229.0 -have,185.0 -shall,114.0 -come,99.0 -most,85.0 +word,count +sir,72.0 +'tis,71.0 +well,71.0 +go,70.0 which,66.0 +love,66.0 +enter,66.0 +give,65.0 did,65.0 +then,65.0 +very,65.0 +hath,64.0 +must,62.0 +laer,62.0 +speak,60.0 +why,60.0 +an,59.0 +should,59.0 +such,58.0 thee,58.0 +oph,58.0 +when,57.0 +their,57.0 +some,56.0 +i'll,56.0 +one,55.0 +am,55.0 +upon,55.0 +make,55.0 +out,55.0 here,54.0 +than,54.0 too,49.0 -thus,39.0 -look,38.0 -life,33.0 -hear,32.0 -were,28.0 -nature,27.0 -rosencrantz,26.0 -show,23.0 -eyes,22.0 -first,21.0 -himself,21.0 -end,19.0 -makes,18.0 -body,17.0 -young,17.0 -state,15.0 -eye,15.0 -something,14.0 -reason,14.0 -further,13.0 -what's,13.0 -grave,12.0 -sleep,12.0 -e'en,12.0 -myself,11.0 -wind,11.0 -only,11.0 -madam,10.0 -mean,10.0 -late,9.0 -seek,9.0 -days,9.0 -month,9.0 -lay,9.0 -here's,8.0 -gave,8.0 -times,8.0 -pale,8.0 -lordship,8.0 -either,7.0 -wherein,7.0 -whether,7.0 -tears,7.0 -effect,7.0 -foils,6.0 -audience,6.0 -beast,6.0 -dumb,6.0 -maid,6.0 -send,6.0 -mouth,6.0 -need,6.0 -poison,6.0 -dull,6.0 -ah,5.0 -save,5.0 -plain,5.0 -fee,5.0 -ambassadors,5.0 -drown,5.0 -carriages,5.0 -books,5.0 -&c,5.0 -natural,5.0 -silence,5.0 -'twas,5.0 -humbly,5.0 -iii,4.0 -lend,4.0 -discretion,4.0 -assume,4.0 -affection,4.0 -secret,4.0 -imports,4.0 -six,4.0 -snow,4.0 -clouds,4.0 -horrible,4.0 -also,4.0 -sits,4.0 -weeds,4.0 -country,4.0 -priest,4.0 -censure,4.0 -danes,4.0 -grown,4.0 -change,4.0 -start,4.0 -gaming,3.0 diff --git a/examples/hamlet_word_count_08.csv b/examples/hamlet_word_count_08.csv index c391ef5..322d1ee 100644 --- a/examples/hamlet_word_count_08.csv +++ b/examples/hamlet_word_count_08.csv @@ -1,101 +1,52 @@ -in,444.0 -is,359.0 -but,263.0 -him,195.0 -by,140.0 -good,99.0 -like,80.0 -us,73.0 -speak,60.0 -such,58.0 -make,55.0 +word,count +these,54.0 +say,53.0 +where,53.0 +ros,53.0 +man,51.0 +father,51.0 much,48.0 +see,48.0 +time,47.0 +clown,47.0 +think,47.0 +she,47.0 +had,44.0 +who,44.0 +horatio,43.0 +laertes,43.0 +heaven,43.0 +tell,43.0 play,42.0 +yet,41.0 +can,39.0 +thus,39.0 +own,39.0 +exit,39.0 +take,38.0 +nor,38.0 +look,38.0 +up,37.0 death,37.0 +mother,37.0 +exeunt,36.0 +polonius,35.0 +guil,35.0 +mar,35.0 +etext,34.0 +soul,34.0 +life,33.0 +could,33.0 +project,33.0 into,32.0 +ghost,32.0 +within,32.0 +mine,32.0 +dead,32.0 +hear,32.0 made,32.0 -god,28.0 -doth,27.0 -osr,25.0 -put,24.0 -without,22.0 -two,21.0 -madness,21.0 -believe,19.0 -has,18.0 -farewell,17.0 -better,17.0 -stand,15.0 -bear,15.0 -free,14.0 -yourself,14.0 -goes,13.0 -virtue,13.0 -ourselves,12.0 -ere,12.0 -bring,12.0 -o',11.0 -purpose,11.0 -honest,11.0 -excellent,10.0 -command,10.0 -draw,9.0 -ears,9.0 -uncle,9.0 -place,9.0 -custom,9.0 -black,8.0 -charge,8.0 -meet,8.0 -try,8.0 -heavens,8.0 -sound,7.0 -under,7.0 -enough,7.0 -do't,7.0 -ha,7.0 -ill,6.0 -cock,6.0 -brain,6.0 -hit,6.0 -pardon,6.0 -sea,6.0 -season,6.0 -touch,6.0 -herself,6.0 -danger,5.0 -hard,5.0 -unless,5.0 -shakespeare,5.0 -thyself,5.0 -moon,5.0 -gutenberg-tm,5.0 -arras,5.0 -door,5.0 -gentle,5.0 -keeps,5.0 -course,5.0 -warlike,5.0 -including,5.0 -half,5.0 -instant,4.0 -entertainment,4.0 -took,4.0 -follows,4.0 -cup,4.0 -sailors,4.0 -practice,4.0 -refund,4.0 -stands,4.0 -weep,4.0 -kill,4.0 -infinite,4.0 -states,4.0 -to-morrow,4.0 -brow,4.0 -seeing,4.0 -warranties,4.0 -bore,4.0 -sending,4.0 -drift,4.0 -golden,3.0 +other,32.0 +night,31.0 +whose,31.0 +might,31.0 +poor,20.0 diff --git a/examples/hamlet_word_count_09.csv b/examples/hamlet_word_count_09.csv index 1b93418..0d084a6 100644 --- a/examples/hamlet_word_count_09.csv +++ b/examples/hamlet_word_count_09.csv @@ -1,101 +1,87 @@ -it,428.0 -that,391.0 -your,252.0 -king,193.0 -all,125.0 -thou,103.0 -how,89.0 -'tis,71.0 -then,65.0 -some,56.0 -these,54.0 -she,47.0 -yet,41.0 -up,37.0 -could,33.0 -other,32.0 +word,count +cannot,30.0 +nothing,30.0 +again,30.0 +indeed,30.0 +guildenstern,29.0 +both,29.0 +leave,28.0 +dear,28.0 +were,28.0 +god,28.0 ophelia,28.0 +been,28.0 +even,27.0 +matter,27.0 +down,27.0 +heart,27.0 +nature,27.0 +doth,27.0 does,26.0 +sweet,26.0 +any,26.0 +head,26.0 part,26.0 +away,26.0 +great,26.0 +world,26.0 +never,26.0 +hold,26.0 +rosencrantz,26.0 +osr,25.0 +nay,25.0 +earth,24.0 +put,24.0 itself,24.0 +comes,24.0 +set,24.0 +scene,24.0 +true,23.0 +against,23.0 +show,23.0 +those,23.0 +day,23.0 +seen,22.0 +eyes,22.0 +without,22.0 though,22.0 +about,22.0 +call,22.0 +i',22.0 +before,22.0 +denmark,22.0 +first,21.0 +two,21.0 get,21.0 +done,21.0 +players,21.0 +ber,21.0 +till,21.0 +fair,21.0 +mad,21.0 +himself,21.0 +madness,21.0 still,21.0 +means,21.0 +son,21.0 +fear,20.0 +since,20.0 +old,20.0 +use,20.0 +england,20.0 +off,20.0 +friends,19.0 +gutenberg,19.0 +end,19.0 +believe,19.0 follow,19.0 +keep,19.0 +hand,19.0 +act,19.0 +many,18.0 +makes,18.0 +has,18.0 cause,18.0 -find,17.0 -sword,16.0 -marry,16.0 -room,15.0 -each,14.0 -heard,14.0 -sent,13.0 -sense,13.0 -same,12.0 -oft,12.0 -marcellus,12.0 -'twere,11.0 -in't,11.0 -friend,11.0 -news,10.0 -thanks,10.0 -stay,9.0 -fell,9.0 -copyright,9.0 -alone,9.0 -ground,9.0 -fellow,8.0 -quick,8.0 -music,8.0 -king's,8.0 -woe,8.0 -money,7.0 -general,7.0 -dust,7.0 -whole,7.0 -march,7.0 -discourse,6.0 -pyrrhus,6.0 -speaks,6.0 -dane,6.0 -round,6.0 -pass,6.0 -wisdom,6.0 -yours,6.0 -anon,6.0 -knave,5.0 -disposition,5.0 -pay,5.0 -french,5.0 -dangerous,5.0 -figure,5.0 -hide,5.0 -quiet,5.0 -found,5.0 -colour,5.0 -fie,5.0 -above,5.0 -alexander,5.0 -throw,5.0 -begin,5.0 -presently,4.0 -direct,4.0 -die,4.0 -imagination,4.0 -got,4.0 -ecstasy,4.0 -impart,4.0 -commandment,4.0 -platform,4.0 -violent,4.0 -straight,4.0 -lest,4.0 -cunning,4.0 -ease,4.0 -wits,4.0 -lords,4.0 -methinks,4.0 -herein,4.0 -trumpets,4.0 -strong,4.0 -dozen,3.0 +form,18.0 +thing,18.0 +little,18.0 diff --git a/examples/hamlet_word_count_10.csv b/examples/hamlet_word_count_10.csv new file mode 100644 index 0000000..b0d31d2 --- /dev/null +++ b/examples/hamlet_word_count_10.csv @@ -0,0 +1,144 @@ +word,count +father's,18.0 +blood,18.0 +art,17.0 +body,17.0 +farewell,17.0 +find,17.0 +once,17.0 +ear,17.0 +please,17.0 +long,17.0 +faith,17.0 +else,17.0 +noble,17.0 +young,17.0 +better,17.0 +sword,16.0 +is't,16.0 +question,16.0 +youth,16.0 +that's,16.0 +speech,16.0 +there's,16.0 +marry,16.0 +thoughts,16.0 +majesty,16.0 +last,16.0 +hast,16.0 +therefore,16.0 +watch,15.0 +castle,15.0 +state,15.0 +stand,15.0 +fortinbras,15.0 +said,15.0 +eye,15.0 +bear,15.0 +room,15.0 +etexts,15.0 +between,15.0 +live,15.0 +rest,15.0 +things,15.0 +tongue,15.0 +sings,14.0 +something,14.0 +free,14.0 +each,14.0 +grief,14.0 +o'er,14.0 +mark,14.0 +answer,14.0 +ever,14.0 +lady,14.0 +reason,14.0 +yourself,14.0 +heard,14.0 +welcome,14.0 +another,14.0 +work,14.0 +word,14.0 +gone,14.0 +none,13.0 +gertrude,13.0 +rey,13.0 +further,13.0 +goes,13.0 +sent,13.0 +duty,13.0 +spirit,13.0 +kind,13.0 +dost,13.0 +thine,13.0 +haste,13.0 +norway,13.0 +what's,13.0 +virtue,13.0 +sense,13.0 +grace,13.0 +gentleman,13.0 +we'll,13.0 +daughter,13.0 +after,13.0 +ho,12.0 +murder,12.0 +grave,12.0 +ourselves,12.0 +same,12.0 +awhile,12.0 +hands,12.0 +help,12.0 +gentlemen,12.0 +together,12.0 +voice,12.0 +air,12.0 +sleep,12.0 +ere,12.0 +oft,12.0 +thousand,12.0 +second,12.0 +drink,12.0 +right,12.0 +saw,12.0 +fit,12.0 +being,12.0 +e'en,12.0 +bring,12.0 +marcellus,12.0 +neither,11.0 +men,11.0 +revenge,11.0 +mind,11.0 +to-night,11.0 +through,11.0 +name,11.0 +he's,11.0 +thought,11.0 +given,11.0 +alas,11.0 +sure,11.0 +myself,11.0 +o',11.0 +'twere,11.0 +villain,11.0 +takes,11.0 +bed,11.0 +remember,11.0 +business,11.0 +receive,11.0 +foul,11.0 +wind,11.0 +purpose,11.0 +in't,11.0 +full,11.0 +fire,11.0 +fortune,11.0 +best,11.0 +face,11.0 +far,11.0 +way,11.0 +only,11.0 +honest,11.0 +friend,11.0 +passion,11.0 diff --git a/examples/header.csv b/examples/header.csv new file mode 100644 index 0000000..c9e1a71 --- /dev/null +++ b/examples/header.csv @@ -0,0 +1,5 @@ +word,freq +foo,23 +bar,10 +eff,1 +you,8 diff --git a/examples/header_0.csv b/examples/header_0.csv new file mode 100644 index 0000000..5bc796f --- /dev/null +++ b/examples/header_0.csv @@ -0,0 +1,2 @@ +word,freq +foo,23.0 diff --git a/examples/header_1.csv b/examples/header_1.csv new file mode 100644 index 0000000..919b340 --- /dev/null +++ b/examples/header_1.csv @@ -0,0 +1,2 @@ +word,freq +bar,10.0 diff --git a/examples/header_2.csv b/examples/header_2.csv new file mode 100644 index 0000000..f4de20a --- /dev/null +++ b/examples/header_2.csv @@ -0,0 +1,3 @@ +word,freq +you,8.0 +eff,1.0 diff --git a/examples/headerless.csv b/examples/headerless.csv new file mode 100644 index 0000000..70838b3 --- /dev/null +++ b/examples/headerless.csv @@ -0,0 +1,4 @@ +foo,23 +bar,10 +eff,1 +you,8 diff --git a/examples/headerless_0.csv b/examples/headerless_0.csv new file mode 100644 index 0000000..91be5e0 --- /dev/null +++ b/examples/headerless_0.csv @@ -0,0 +1 @@ +foo,23.0 diff --git a/examples/headerless_1.csv b/examples/headerless_1.csv new file mode 100644 index 0000000..61ad3af --- /dev/null +++ b/examples/headerless_1.csv @@ -0,0 +1 @@ +bar,10.0 diff --git a/examples/headerless_2.csv b/examples/headerless_2.csv new file mode 100644 index 0000000..902d171 --- /dev/null +++ b/examples/headerless_2.csv @@ -0,0 +1,2 @@ +you,8.0 +eff,1.0 diff --git a/setup.py b/setup.py index a95c8a5..faaed9b 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup(name='binpacking', - version='1.4.3', + version='1.4.5', description='Heuristic distribution of weighted items to bins (either a fixed number of bins or a fixed number of volume per bin). Data may be in form of list, dictionary, list of tuples or csv-file.', url='https://www.github.com/benmaier/binpacking', author='Benjamin F. Maier', @@ -22,10 +22,10 @@ }, classifiers=['License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7' + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9' ], zip_safe=False)