Dataset Viewer
Auto-converted to Parquet
html_url
stringlengths
51
51
title
stringlengths
6
280
comments
stringlengths
63
141k
body
stringlengths
18
58.6k
comment_length
int64
16
10.8k
text
stringlengths
6
280
embeddings
listlengths
768
768
https://github.com/huggingface/datasets/issues/5430
Support Apache Beam >= 2.44.0
Some of the shard files now have 0 number of rows. We have opened an issue in the Apache Beam repo: - https://github.com/apache/beam/issues/25041
Once we find out the root cause of: - #5426 we should revert the temporary pin on apache-beam introduced by: - #5429
23
Support Apache Beam >= 2.44.0
[ -0.33163198828697205, -0.19468018412590027, -0.2538297772407532, -0.18167351186275482, 0.08133967965841293, -0.14635992050170898, -0.05522572621703148, 0.48587194085121155, -0.11430386453866959, 0.13749493658542633, 0.11392970383167267, 0.018100185319781303, -0.3649848401546478, 0.15086089074611664, -0.14473597705364227, -0.26746222376823425, 0.18078574538230896, 0.015807291492819786, -0.24190235137939453, -0.012461784295737743, -0.03617044910788536, 0.2676854431629181, -0.23407498002052307, -0.0942520946264267, 0.12334498018026352, 0.12019836157560349, 0.22402092814445496, 0.055669646710157394, -0.36422014236450195, -0.0666096955537796, -0.05600430443882942, -0.010724073275923729, 0.25559183955192566, 0.018087564036250114, -0.00010409302922198549, 0.17011401057243347, 0.44838592410087585, -0.09103263914585114, -0.0725686177611351, 0.25959137082099915, -0.22060051560401917, -0.14707686007022858, -0.1557883769273758, 0.1164657324552536, -0.29036831855773926, -0.5176599025726318, 0.0692407488822937, -0.1826099157333374, 0.47059741616249084, 0.07746058702468872, 0.30541524291038513, 0.42275702953338623, 0.18398883938789368, -0.08961459994316101, 0.49926936626434326, -0.0980447307229042, -0.14492832124233246, -0.1624554991722107, 0.17978982627391815, -0.05001618340611458, -0.5054320693016052, 0.2753634452819824, 0.08110276609659195, -0.16996312141418457, 0.05405769497156143, -0.5291945934295654, 0.13866855204105377, -0.21482478082180023, 0.06839753687381744, -0.0881117433309555, 0.3153679370880127, 0.02339843288064003, -0.11360365152359009, 0.2655511796474457, -0.048987120389938354, 0.1915910840034485, 0.2930615246295929, -0.1256420612335205, 0.037057433277368546, 0.23020926117897034, 0.08936123549938202, -0.22068250179290771, -0.4544356167316437, 0.005928186699748039, 0.14755277335643768, 0.4651930332183838, 0.03253912925720215, 0.09497176110744476, 0.10917805135250092, -0.103162482380867, 0.21276472508907318, 0.21663060784339905, -0.3029969334602356, 0.16907885670661926, -0.08975426852703094, -0.0676017627120018, -0.09394688159227371, 0.17146027088165283, 0.11941760033369064, 0.31287631392478943, -0.15554742515087128, 0.40823742747306824, 0.08478456735610962, -0.06261047720909119, -0.2851749658584595, 0.1703866869211197, 0.2634938359260559, -0.3332340717315674, 0.26589056849479675, 0.012899775058031082, 0.313581645488739, 0.08549685776233673, -0.05798013135790825, -0.5047074556350708, -0.6001992225646973, 0.1974962055683136, -0.23585310578346252, 0.09856487065553665, 0.2507464289665222, 0.01293108332902193, -0.33907079696655273, 0.0332845002412796, 0.0223406795412302, 0.21793879568576813, 0.41154739260673523, 0.5633814334869385, 0.11989524215459824, 0.08622413873672485, -0.1465519517660141, -0.6754918098449707, -0.03452605754137039, 0.13805003464221954, -0.3025331199169159, -0.051317248493433, 0.21037840843200684, 0.36395543813705444, 0.026898350566625595, -0.08103158324956894, 0.46250930428504944, 0.12905006110668182, 0.06533604115247726, 0.4398930072784424, 0.04195822775363922, 0.2407432645559311, 0.042652104049921036, 0.14531689882278442, -0.2352825552225113, 0.38194045424461365, 0.10539163649082184, -0.05160265788435936, -0.07798576354980469, -0.23435582220554352, 0.013689334504306316, 0.21279266476631165, 0.07900388538837433, 0.35932809114456177, 0.09674113243818283, -0.09215766936540604, -0.310016006231308, -0.0055082920007407665, 0.0677732527256012, 0.05067990720272064, 0.2700706720352173, -0.08414396643638611, 0.002590556861832738, 0.1011972725391388, 0.17908047139644623, 0.029493864625692368, 0.19500818848609924, -0.29596638679504395, -0.20948074758052826, -0.1080894023180008, 0.10094337910413742, -0.41041067242622375, -0.13976450264453888, -0.25697752833366394, 0.6113802790641785, -0.5492427349090576, -0.08104345202445984, 0.30023494362831116, 0.06506349891424179, -0.31679853796958923, 0.3391968607902527, 0.08320295065641403, 0.058981407433748245, -0.012690181843936443, -0.5580596923828125, 0.19551728665828705, 0.14158175885677338, 0.14231599867343903, -0.19258145987987518, -0.09728986769914627, -0.517462968826294, 0.1776781976222992, 0.30492353439331055, 0.028877347707748413, 0.2894851863384247, 0.23260118067264557, 0.13049845397472382, -0.08838990330696106, 0.3229178190231323, 0.12281706184148788, -0.03252654895186424, -0.1698429435491562, 0.18262113630771637, 0.23002758622169495, 0.015483388677239418, -0.037312526255846024, -0.48277005553245544, 0.1579776108264923, 0.4957022964954376, 0.1924978345632553, -0.10720033198595047, 0.059264279901981354, 0.0019494551233947277, -0.19109848141670227, 0.21715989708900452, 0.029847726225852966, -0.046288926154375076, -0.048096682876348495, -0.23470133543014526, 0.22270913422107697, 0.0008312246645800769, -0.007089926395565271, 0.011586667969822884, 0.12690864503383636, -0.08769117295742035, -0.03645636886358261, 0.24007345736026764, 0.029980100691318512, 0.13895533978939056, -0.30892741680145264, -0.06182979419827461, 0.34953486919403076, -0.3415210247039795, 0.35749274492263794, -0.00675874762237072, 0.47248294949531555, 0.2115306556224823, -0.49477341771125793, 0.3484075665473938, -0.2180432677268982, -0.1716996431350708, -0.028894659131765366, 0.3848092257976532, 0.09675192832946777, 0.28485986590385437, -0.020246513187885284, 0.12428964674472809, 0.19841328263282776, 0.0954601988196373, 0.09136103838682175, -0.24007131159305573, -0.05991898477077484, 0.2073781043291092, -0.018602820113301277, -0.07601763308048248, -0.19731660187244415, 0.28063926100730896, -0.28618016839027405, 0.14068634808063507, -0.062198735773563385, 0.04119626805186272, -0.14618034660816193, -0.23302404582500458, 0.07524175196886063, 0.45518696308135986, -0.21612952649593353, -0.14003953337669373, 0.31485047936439514, -0.19092369079589844, 0.04070814326405525, 0.19544246792793274, -0.27049046754837036, 0.17181259393692017, -0.13643969595432281, 0.19541820883750916, 0.1503969132900238, 0.20464743673801422, -0.19140858948230743, 0.02938142791390419, -0.10040666162967682, -0.14500048756599426, -0.13994483649730682, -0.20080280303955078, -0.06845799833536148, -0.18457528948783875, -0.1639721542596817, -0.252178817987442, 0.28646793961524963, -0.3253401219844818, -0.3195045292377472, 0.31039658188819885, 0.22442632913589478, -0.08433268219232559, 0.3754761219024658, 0.3887667655944824, 0.08604869991540909, 0.3328970968723297, -0.01728370413184166, -0.28310897946357727, -0.024139417335391045, -0.18033111095428467, 0.2320704311132431, 0.02426782064139843, -0.07690031826496124, 0.09554128348827362, -0.00584601704031229, 0.003509306814521551, -0.45196548104286194, -0.17558443546295166, 0.2532351613044739, 0.08629994094371796, -0.18672296404838562, 0.19717594981193542, 0.07710252702236176, 0.04598257318139076, 0.3659266531467438, 0.11135800182819366, -0.35557982325553894, -0.0709933191537857, 0.03854973614215851, -0.12118159234523773, 0.20420606434345245, -0.037816356867551804, -0.09291937202215195, 0.3073236346244812, -0.4591861069202423, -0.12269148975610733, 0.2209513634443283, -0.07629801332950592, -0.02613305300474167, 0.04574022442102432, -0.21050740778446198, 0.2271510511636734, -0.19335529208183289, 0.1800549477338791, -0.01663435436785221, 0.17850515246391296, -0.30063486099243164, -0.23276305198669434, 0.1369301825761795, 0.10884615778923035, 0.08987519890069962, 0.3222624361515045, -0.052694130688905716, -0.2088286429643631, 0.19922924041748047, -0.027983970940113068, -0.15356257557868958, -0.10655245929956436, 0.35710409283638, 0.06169333681464195, -0.15579178929328918, -0.26101839542388916, 0.20623934268951416, 0.020622212439775467, -0.18465933203697205, 0.21102342009544373, 0.3055804967880249, -0.17300309240818024, 0.05364205688238144, 0.8341581225395203, -0.07302983105182648, -0.051374927163124084, 0.28459182381629944, 0.10348537564277649, 0.1515985131263733, 0.026462072506546974, 0.16072434186935425, 0.2421441525220871, 0.36879345774650574, 0.2691703140735626, 0.04338693618774414, 0.1896488070487976, 0.17480960488319397, -0.36914610862731934, -0.2050124555826187, -0.051007796078920364, 0.053706202656030655, 0.09352786093950272, -0.16588670015335083, 0.2674780786037445, -0.07519213855266571, 0.12192828953266144, 0.18067295849323273, -0.16725069284439087, 0.5287700891494751, 0.15966659784317017, -0.04300244525074959, 0.04460464045405388, 0.2930268943309784, 0.21535922586917877, -0.3777129352092743, 0.3992818593978882, -0.07794485986232758, 0.106968954205513, -0.08204519748687744, -0.3837517499923706, 0.11945363879203796, -0.236375093460083, 0.5144768357276917, -0.4901544153690338, 0.1707945317029953, 0.07283134013414383, 0.416113018989563, -0.35117658972740173, -0.07256492227315903, -0.017197607085108757, -0.0034600840881466866, 0.0064931814558804035, -0.2207905650138855, 0.18891270458698273, -0.04946095496416092, 0.13002902269363403, -0.3041497766971588, -0.07755663990974426, -0.18643750250339508, -0.2068472057580948, 0.23724772036075592, -0.08459228277206421, -0.2313639223575592, -0.17087377607822418, -0.11836335062980652, -0.1554342657327652, -0.11004049330949783, 0.031102754175662994, -0.6316107511520386, -0.17733536660671234, 0.06852906942367554, -0.0626525729894638, -0.3157806992530823, -0.4174819886684418, -0.020320827141404152, 0.38364267349243164, 0.0055405558086931705, -0.33316805958747864, 0.17412711679935455, 0.16941146552562714, 0.2222096472978592, 0.0998908281326294, -0.034198254346847534, 0.17292754352092743, -0.09431753307580948, -0.1706337183713913, -0.09228621423244476, -0.032770104706287384, -0.1075526773929596, -0.036615945398807526, 0.06376942247152328, -0.21783949434757233, -0.15757811069488525, 0.18764787912368774, 0.19937129318714142, -0.19910575449466705, -0.19949130713939667, 0.0863109603524208, 0.19919942319393158, -0.22761686146259308, 0.2582709491252899, 0.09086024016141891, 0.8255579471588135, -0.13202504813671112, -0.1085088923573494, 0.13382308185100555, 0.017092570662498474, 0.34174713492393494, -1.018960952758789, 0.2465243935585022, -0.30447274446487427, 0.09391098469495773, -0.06720204651355743, 0.0004403883358463645, 0.365788072347641, -0.051240961998701096, -0.12970316410064697, 0.31659379601478577, 0.3784840404987335, 0.503405749797821, -0.04799618199467659, 0.26035794615745544, -0.34639909863471985, -0.09095663577318192, -0.2544470429420471, 0.18273673951625824, 0.06737177073955536, 0.1307019591331482, -0.33582454919815063, 0.010889749974012375, 0.05738934129476547, -0.36197569966316223, -0.2313205897808075, 0.030455444008111954, -0.029498033225536346, 0.02968001179397106, -0.14173482358455658, -0.06729516386985779, -0.06223444268107414, -0.16733942925930023, 0.20873044431209564, -0.014835596084594727, -0.1692216843366623, 0.29325607419013977, 0.2660076916217804, -0.17703890800476074, -0.0738353282213211, 0.16071419417858124, 0.05656367912888527, -0.21573586761951447, -0.05757145583629608, 0.2599540948867798, -0.04743682220578194, -0.32854777574539185, -0.12182573229074478, -0.11239932477474213, 0.5219278931617737, 0.19302602112293243, 0.4947345554828644, 0.005806997884064913, -0.302437961101532, 0.06746909767389297, 0.2423696368932724, -0.4555344879627228, -0.12976668775081635, -0.17050600051879883, 0.20126096904277802, -0.04819488152861595, -0.0821872279047966, 0.31014207005500793, -0.18725453317165375, -0.22853754460811615, -0.22801929712295532, 0.22752395272254944, -0.08282413333654404, -0.3449576199054718, 0.1616552174091339, 0.13932330906391144, -0.2991896867752075, -0.13013392686843872, 0.051427725702524185, -0.4642859995365143, 0.14816129207611084, 0.1716863363981247, 0.0670597031712532, 0.3825206458568573, -0.07004820555448532, -0.06409738957881927, -0.00989670492708683, 0.08048651367425919, -0.39576855301856995, -0.08024396002292633, -0.06317795813083649, 0.042051807045936584, 0.3549911379814148, -0.25713297724723816, -0.3578502833843231, -0.2912408113479614, 0.289498507976532, -0.07250087708234787, 0.3154638707637787, 0.12820422649383545, 0.17993678152561188, 0.21980638802051544, 0.21041147410869598, 0.07021431624889374, -0.45950400829315186, -0.19684039056301117, 0.23155292868614197, 0.09719064086675644, -0.14345286786556244, -0.05431779474020004, -0.040992941707372665, -0.1103370189666748, -0.21793057024478912, 0.005145709030330181, 0.06777317821979523, -0.12473230063915253, -0.19561505317687988, -0.009404873475432396, 0.13466192781925201, 0.21769268810749054, -0.03086008131504059, 0.14935484528541565, -0.09899938851594925, 0.42307040095329285, -0.1298217475414276, -0.11919693648815155, 0.3244655132293701, -0.21356704831123352, -0.020233169198036194, 0.15270404517650604, 0.016117746010422707, 0.1153896152973175, 0.1416669338941574, 0.11443992704153061, -0.27036067843437195, 0.09964653104543686, 0.3804596960544586, -0.19436277449131012, -0.04789721220731735, -0.24573129415512085, 0.08450326323509216, 0.26510879397392273, 0.007509872782975435, 0.064508818089962, 0.1559692919254303, 0.20365819334983826, -0.010516361333429813, 0.18739259243011475, 0.36723196506500244, -0.41852983832359314, 0.2626913785934448, 0.23942439258098602, -0.13758258521556854, -0.016883116215467453, 0.019448837265372276, 0.04148845374584198, 0.1940629929304123, 0.1198771521449089, -0.2671278715133667, -0.4203987717628479, 0.27111971378326416, 0.2890254855155945, -0.330474853515625, 0.5450810790061951, 0.2857191562652588, 0.12817226350307465, 0.0425637811422348, -0.056485600769519806, -0.1379702240228653, 0.280313640832901, 0.17944210767745972, 0.267895370721817, 0.18501339852809906, 0.3497191369533539, 0.5261208415031433, -0.18735665082931519, -0.37977632880210876, 0.12612679600715637, 0.03468159958720207, 0.12003061920404434, -0.11396871507167816, -0.14065872132778168, -0.2755987346172333, 0.041649527847766876, 0.02585332840681076, 0.15400877594947815, 0.22865663468837738, 0.28843170404434204, 0.17634356021881104, -0.10582659393548965, 0.16656644642353058, -0.20486551523208618, 0.0849509984254837, -0.025664260610938072, 0.2595047652721405, 0.1402466744184494, -0.04981357231736183, 0.44873523712158203, -0.14188647270202637, 0.03175775334239006, 0.0779808834195137, -0.12696769833564758, -0.19130948185920715, 0.014737759716808796, -0.01478907372802496, -0.14249393343925476, 0.03936927393078804, 0.06367030739784241, 0.08933652192354202, 0.030505580827593803, 0.21399715542793274, -0.1852361410856247, -0.29413357377052307, -0.028903964906930923, 0.017843138426542282, -0.2557530403137207, -0.09139121323823929, 0.12988018989562988, 0.11828223615884781, -0.23332183063030243, 0.19497153162956238, -0.3601806163787842, -0.053111959248781204, -0.27065372467041016, -0.1016768291592598, -0.047235652804374695, -0.12030091136693954, 0.10401574522256851, -0.13182733952999115, 0.4967596232891083, -0.03390134498476982, 0.03019433282315731, 0.1725684255361557, -0.5566698908805847, -0.10419165343046188, 0.131647527217865, 0.07564299553632736, 0.24118509888648987, -0.4793643057346344, 0.0015896909171715379, 0.11057036370038986, 0.07579435408115387, 0.26589059829711914, -0.21931785345077515, 0.2348901629447937, -0.08551622927188873, -0.189484104514122, 0.10868587344884872, 0.1603788286447525, 0.0935119166970253, -0.09001073986291885, -0.1286972165107727, 0.23033761978149414, 0.12172894179821014, 0.17473317682743073, -0.06178082525730133, -0.3571937680244446, 0.26709941029548645, -0.23321522772312164, 0.4560467600822449, 0.11425968259572983, -0.03944345563650131, -0.18775500357151031, -0.2687270939350128, -0.26427847146987915, 0.03521411120891571, -0.006718870718032122, -0.09757009893655777, -0.12513798475265503, 0.23202216625213623, -0.24004700779914856, 0.0710977166891098, -0.3031572699546814, 0.20972970128059387, -0.13409283757209778, 0.4377794563770294, -0.4609697163105011, -0.008483219891786575, -0.26420697569847107, 0.1695151925086975, -0.2898379862308502, -0.234447181224823, 0.10967230796813965, -0.29178404808044434, -0.26136040687561035, -0.14698709547519684, 0.030032316222786903, -0.6167478561401367, -0.10691425949335098, 0.14819416403770447, 0.02276589721441269, -0.05859375, 0.11399625241756439, -0.2513325810432434, 0.1574094146490097, 0.10525603592395782, 0.37961792945861816, 0.26064416766166687, 0.0043786088936030865, -0.17508411407470703, -0.1451762467622757, -0.2000213861465454, -0.59076988697052, 0.15962044894695282, -0.08884715288877487, -0.09776978939771652, -0.24871717393398285 ]
https://github.com/huggingface/datasets/issues/5428
Load/Save FAISS index using fsspec
Hi! Sure, feel free to submit a PR. Maybe if we want to be consistent with the existing API, it would be cleaner to directly add support for `fsspec` paths in `Dataset.load_faiss_index`/`Dataset.save_faiss_index` in the same manner as it was done in `Dataset.load_from_disk`/`Dataset.save_to_disk`.
### Feature request From what I understand `faiss` already support this [link](https://github.com/facebookresearch/faiss/wiki/Index-IO,-cloning-and-hyper-parameter-tuning#generic-io-support) I would like to use a stream as input to `Dataset.load_faiss_index` and `Dataset.save_faiss_index`. ### Motivation In my case, I'm saving faiss index in cloud storage and use `fsspec` to load them. It would be ideal if I could send the stream directly instead of copying the file locally (or mounting the bucket) and then load the index. ### Your contribution I can submit the PR
42
Load/Save FAISS index using fsspec
[ -0.4125467538833618, -0.10050997883081436, -0.1457543522119522, 0.24869272112846375, 0.16829943656921387, 0.10180100053548813, 0.12143128365278244, 0.04269787296652794, 0.6353223323822021, 0.4917266070842743, -0.328125923871994, -0.18137507140636444, 0.27530619502067566, 0.387371689081192, -0.2596972584724426, 0.4451923072338104, 0.09276141971349716, 0.2732202410697937, 0.07167971879243851, -0.01405042503029108, -0.22151881456375122, 0.09567815065383911, 0.02876899391412735, 0.006463668309152126, -0.11913784593343735, 0.1881265640258789, -0.2237548828125, 0.4578928053379059, -0.09613530337810516, -0.22418718039989471, 0.1611860990524292, 0.09405355155467987, 0.20253342390060425, -0.14363421499729156, -0.00011357487528584898, 0.06261597573757172, 0.21048033237457275, -0.13458755612373352, -0.08268477022647858, 0.4062061607837677, -0.2765233516693115, 0.41762715578079224, -0.16739261150360107, -0.36859947443008423, -0.28214821219444275, -0.14825770258903503, 0.051289815455675125, -0.11457903683185577, 0.1782049834728241, 0.330748587846756, 0.1852474808692932, -0.24933631718158722, -0.0794694572687149, -0.0732790008187294, 0.29805079102516174, -0.4439971148967743, 0.15715208649635315, -0.32958006858825684, -0.35522907972335815, 0.1671033650636673, 0.21970979869365692, -0.2503509819507599, -0.0620688796043396, -0.45093604922294617, -0.14164747297763824, -0.018928684294223785, 0.7166465520858765, 0.01026060339063406, 0.19332872331142426, -0.008832293562591076, 0.2990364730358124, -0.13772618770599365, -0.16474716365337372, 0.3567412495613098, 0.030661769211292267, -0.039986565709114075, -0.1506335586309433, -0.255885511636734, 0.20043645799160004, 0.29767829179763794, 0.6618044376373291, -0.23728910088539124, -0.21642696857452393, 0.06439685821533203, 0.07248754054307938, -0.1889209896326065, -0.043970122933387756, -0.06115437299013138, 0.07014665007591248, -0.23995637893676758, -0.4423810541629791, -0.07242043316364288, -0.13137350976467133, 0.11224338412284851, 0.009116566739976406, -0.09809272736310959, 0.41784608364105225, -0.35464829206466675, -0.14361825585365295, -0.031889017671346664, -0.3425063192844391, 0.439985454082489, 0.059758104383945465, 0.24583955109119415, -0.1923569142818451, 0.12155605852603912, 0.2878186106681824, -0.4031928479671478, 0.05147667974233627, -0.10519668459892273, -0.12454404681921005, -0.020628688856959343, -0.04487361013889313, 0.1506355255842209, -0.585381031036377, 0.055162496864795685, -0.12246376276016235, -0.39397889375686646, -0.31102603673934937, 0.26946964859962463, 0.42066633701324463, -0.0478699691593647, 0.0206338819116354, 0.7791003584861755, 0.25744277238845825, 0.13574178516864777, 0.08414056897163391, 0.05414880812168121, -0.30262482166290283, 0.06801064312458038, -0.3109810948371887, -0.12156473845243454, 0.052961889654397964, 0.2869679629802704, 0.08728037774562836, -0.20529213547706604, -0.02782401256263256, -0.25947093963623047, -0.11877100169658661, 0.014720098115503788, -0.2665911316871643, -0.04810918867588043, 0.11104770004749298, 0.27464911341667175, 0.036337267607450485, -0.15861861407756805, 0.02432946115732193, -0.030515003949403763, -0.08265190571546555, 0.20597903430461884, 0.10895794630050659, -0.2534906566143036, 0.05221571773290634, 0.14851835370063782, 0.23970133066177368, 0.025445660576224327, 0.052995629608631134, 0.1031111404299736, -0.08923087269067764, 0.03472127765417099, -0.09007317572832108, 0.21253089606761932, -0.26437389850616455, -0.19951854646205902, 0.07820095866918564, 0.23606254160404205, 0.1874314248561859, -0.331240713596344, 0.2605569660663605, -0.4291720688343048, -0.13956713676452637, 0.12001589685678482, 0.23618440330028534, 0.18757101893424988, -0.1869693398475647, 0.4018789827823639, 0.6189256310462952, -0.517253041267395, -0.1771218180656433, 0.13691256940364838, 0.21741414070129395, -0.5839591026306152, 0.18740949034690857, 0.023326829075813293, 0.138944610953331, -0.09138308465480804, -0.06063024327158928, 0.23890839517116547, 0.12745019793510437, 0.06806804239749908, -0.20082242786884308, -0.2644282579421997, -0.07421258091926575, 0.06604813784360886, -0.05712464824318886, 0.1273328959941864, 0.24536903202533722, -0.6687988638877869, 0.3584287762641907, -0.12455428391695023, -0.0331350713968277, 0.1283610314130783, 0.3222378194332123, 0.3465747535228729, 0.24425680935382843, -0.07404999434947968, 0.024555647745728493, -0.02664540708065033, -0.3065439760684967, -0.28971123695373535, 0.4283939003944397, -0.000007713383638474625, 0.062469176948070526, 0.09239452332258224, 0.09098607301712036, 0.0773124024271965, 0.02154708467423916, -0.10565070807933807, -0.031771790236234665, -0.17443732917308807, -0.3748488426208496, -0.15640737116336823, -0.14639970660209656, -0.08881940692663193, -0.1333690583705902, 0.17310014367103577, -0.08645574748516083, -0.19689017534255981, 0.1233728677034378, 0.21880610287189484, 0.24049712717533112, -0.08521948009729385, 0.02275967039167881, 0.24698282778263092, 0.4193708598613739, -0.11792922765016556, 0.2660634517669678, 0.1986689269542694, -0.20862920582294464, -0.16450795531272888, -0.027830012142658234, 0.07722389698028564, 0.05720005929470062, 0.04397290199995041, -0.15539197623729706, 0.39605453610420227, 0.08613956719636917, 0.26494258642196655, 0.18018336594104767, -0.30663445591926575, 0.20670399069786072, -0.18082384765148163, 0.18308666348457336, -0.15408580005168915, -0.14260686933994293, 0.2948238253593445, -0.009240050800144672, 0.00951499491930008, 0.1255636215209961, 0.3339282274246216, -0.005948218517005444, -0.1673155128955841, -0.11008858680725098, 0.12894003093242645, 0.0737900510430336, -0.09938175231218338, 0.00789994839578867, -0.730843186378479, 0.18524888157844543, 0.34714192152023315, -0.22164727747440338, -0.19590944051742554, 0.144826278090477, -0.0748705044388771, 0.4730056822299957, -0.30129119753837585, -0.047810256481170654, 0.09719240665435791, 0.09615511447191238, -0.2837067246437073, -0.33328697085380554, -0.008831092156469822, -0.29430171847343445, -0.13917967677116394, -0.2710034251213074, -0.009341560304164886, 0.19508685171604156, -0.2678532004356384, 0.154879629611969, 0.11223003268241882, 0.11722283810377121, -0.16037513315677643, 0.10880620032548904, 0.300019234418869, -0.13911829888820648, -0.003283493220806122, -0.24578872323036194, 0.410025417804718, 0.09912624210119247, 0.058332398533821106, -0.2295517921447754, -0.0531005822122097, -0.25990593433380127, 0.023176545277237892, -0.10024255514144897, 0.35619887709617615, 0.04707247018814087, 0.13944800198078156, 0.015388064086437225, -0.3341889977455139, 0.24746198952198029, 0.26294073462486267, 0.3164224624633789, 0.03736206144094467, -0.1916874498128891, 0.027393337339162827, 0.1821141242980957, 0.05061718448996544, 0.03555216267704964, -0.15083838999271393, -0.2490655928850174, 0.025374526157975197, -0.06453455984592438, -0.07272285223007202, 0.015433339402079582, -0.09466327726840973, 0.10433176904916763, -0.17839090526103973, 0.3020502030849457, -0.16678425669670105, 0.23166941106319427, 0.03676125034689903, -0.04181152582168579, -0.013283204287290573, -0.03352690115571022, -0.05534021928906441, -0.4010359048843384, -0.22856342792510986, 0.05799458175897598, -0.19946283102035522, -0.43580278754234314, 0.003294488415122032, -0.042532797902822495, -0.29966962337493896, -0.04688933864235878, -0.04351629316806793, 0.06164289265871048, -0.009754082188010216, 0.07900772243738174, -0.16992834210395813, 0.3370014429092407, 0.4499833285808563, -0.06975550949573517, -0.2307875007390976, -0.2008523792028427, -0.07255539298057556, 0.4420599937438965, 0.20212294161319733, 0.13040092587471008, -0.4703136384487152, 0.003358058398589492, -0.36375972628593445, 0.4128454029560089, 0.1397564560174942, -0.01495357509702444, 0.497871994972229, -0.2287157028913498, 0.20841890573501587, -0.02498529478907585, -0.09251324087381363, 0.27515318989753723, 0.36276450753211975, -0.1680036187171936, 0.29605603218078613, -0.06268734484910965, -0.14359800517559052, 0.04702121391892433, 0.1430482715368271, -0.0865747258067131, -0.14162646234035492, -0.12255721539258957, 0.3931603729724884, 0.3019804358482361, 0.08856794238090515, 0.26202765107154846, -0.05481637641787529, 0.17614687979221344, 0.3423078656196594, 0.5714543461799622, 0.1191977933049202, -0.1387578845024109, 0.31076398491859436, -0.183850958943367, -0.18817731738090515, 0.32043737173080444, 0.045815519988536835, 0.07974785566329956, -0.13415589928627014, -0.17535710334777832, 0.19668465852737427, -0.17920619249343872, 0.6384797692298889, 0.002430492313578725, 0.10872798413038254, 0.4049743711948395, 0.3216087222099304, -0.38509905338287354, 0.03076883777976036, 0.19632840156555176, -0.019209053367376328, -0.07260681688785553, 0.15168698132038116, -0.293618381023407, -0.2788684666156769, -0.2139257788658142, -0.26306429505348206, -0.4795570969581604, -0.3710206151008606, -0.420378178358078, -0.052710507065057755, -0.2127172201871872, 0.05017447844147682, -0.30182945728302, -0.04079175367951393, 0.20060724020004272, 0.22817285358905792, -0.36624807119369507, -0.15728759765625, -0.06562558561563492, -0.029780035838484764, 0.1686025857925415, 0.22878840565681458, -0.0013355854898691177, 0.2403423935174942, 0.05964644253253937, 0.08104182034730911, 0.14759992063045502, 0.04941640794277191, 0.4115789830684662, 0.12695571780204773, 0.23784689605236053, 0.21584190428256989, 0.27041664719581604, -0.04600357264280319, -0.12310594320297241, -0.23443995416164398, -0.06986856460571289, -0.3049139380455017, 0.16817332804203033, -0.019398488104343414, 0.01238967478275299, -0.14698559045791626, -0.22676722705364227, 0.49395158886909485, -0.36808881163597107, -0.1536029577255249, -0.06795964390039444, 0.37029001116752625, -0.15540994703769684, 0.7915053963661194, 0.06719601899385452, 0.9396705627441406, -0.1737934648990631, 0.1945040076971054, 0.22487607598304749, -0.009335136972367764, -0.25106731057167053, -0.4550761878490448, -0.02291782759130001, -0.47972726821899414, 0.1388753056526184, 0.078526072204113, 0.04009784013032913, -0.04466799274086952, 0.04855847358703613, -0.05860447883605957, 0.2517770528793335, 0.2561227083206177, -0.48303157091140747, 0.04696652665734291, 0.26766106486320496, 0.17408934235572815, -0.19379308819770813, -0.1402965635061264, 0.18998853862285614, 0.17642636597156525, 0.026066845282912254, 0.02166917361319065, 0.012103819288313389, -0.00137138064019382, 0.05315712094306946, -0.04791862517595291, 0.28036120533943176, -0.20839732885360718, 0.41578739881515503, -0.19013799726963043, 0.2885048985481262, -0.38502225279808044, -0.37506189942359924, -0.06565576046705246, -0.3238424062728882, -0.03492780029773712, 0.11670579016208649, 0.20859302580356598, -0.11266002804040909, -0.31836578249931335, -0.14028292894363403, 0.15302464365959167, -0.03392584249377251, -0.0999777764081955, -0.02677830681204796, 0.06774991005659103, -0.26316091418266296, -0.02941863238811493, 0.02040363848209381, -0.07159893214702606, -0.3738173246383667, -0.10449881106615067, 0.26559215784072876, 0.1107361912727356, -0.00755313690751791, 0.09521344304084778, 0.2538849711418152, -0.06952673941850662, 0.3069050908088684, 0.05605199187994003, -0.060911208391189575, -0.04497669264674187, 0.3700411915779114, -0.07328858226537704, 0.13656440377235413, 0.07653910666704178, -0.2675866186618805, -0.13392068445682526, -0.2873739004135132, -0.4245656132698059, 0.008448852226138115, 0.3376365005970001, -0.03783590719103813, 0.06963343918323517, -0.5506467819213867, 0.11319002509117126, 0.3824877440929413, -0.133511021733284, -0.10879279673099518, -0.07106251269578934, -0.09875117242336273, -0.41265255212783813, -0.0074312430806458, 0.11810456216335297, 0.44945427775382996, -0.0294430423527956, 0.16157568991184235, -0.4565465450286865, -0.15629515051841736, -0.30423974990844727, 0.07803354412317276, -0.028599495068192482, 0.20166151225566864, 0.12874707579612732, -0.13449454307556152, 0.11434929072856903, -0.359328031539917, 0.19904044270515442, -0.07453946769237518, -0.1174423098564148, -0.29352059960365295, -0.23168827593326569, 0.1292935460805893, 0.24431553483009338, 0.16537711024284363, -0.4439827799797058, -0.08616378158330917, -0.011056125164031982, -0.12540914118289948, -0.10406816750764847, 0.2320907711982727, -0.21252302825450897, 0.0000414117457694374, 0.12130016088485718, -0.06527623534202576, 0.0571625791490078, 0.3056492507457733, 0.21453125774860382, 0.3334115445613861, -0.09729527682065964, 0.09145765751600266, -0.7348135709762573, -0.09324578940868378, 0.28553351759910583, 0.2732173800468445, 0.6493441462516785, 0.04953060671687126, -0.04622294381260872, 0.0385558120906353, -0.4300343096256256, 0.0378502756357193, -0.015338150784373283, 0.17732107639312744, -0.14222154021263123, 0.02808355912566185, 0.11027160286903381, 0.19861523807048798, -0.002457616850733757, 0.1613319367170334, 0.2189236581325531, -0.5277883410453796, 0.0008257377776317298, 0.1538294404745102, 0.17301465570926666, -0.05860138311982155, -0.02466689422726631, 0.2054993212223053, -0.5121846795082092, 0.6878025531768799, -0.37692803144454956, -0.6378735899925232, 0.13679607212543488, 0.15464912354946136, 0.08589711040258408, 0.162579745054245, 0.3428245186805725, 0.5758480429649353, 0.21934528648853302, 0.2271089106798172, -0.05767861753702164, 0.20310451090335846, -0.3456033170223236, -0.4967891573905945, 0.367331862449646, -0.1919316202402115, 0.021731028333306313, 0.08670239895582199, 0.29249754548072815, 0.4129970073699951, 0.2028260976076126, -0.2976517379283905, -0.1027660146355629, 0.4481179416179657, -0.025517670437693596, -0.41914448142051697, 0.5494886636734009, 0.006026494782418013, 0.21316587924957275, 0.05852450057864189, 0.02786066010594368, -0.0023480395320802927, -0.12347470223903656, 0.11690597236156464, 0.00012256023182999343, 0.09194459021091461, -0.3013637959957123, 0.3486170768737793, 0.35144418478012085, 0.025682944804430008, 0.1515040099620819, -0.25658783316612244, 0.004122944548726082, 0.10965627431869507, -0.04051733762025833, 0.10303524136543274, -0.1187351644039154, -0.260588675737381, 0.21294446289539337, 0.1549535095691681, -0.11676189303398132, -0.17428629100322723, -0.14570161700248718, -0.0972178652882576, 0.018140891566872597, 0.2523932158946991, 0.12179139256477356, -0.18758584558963776, -0.4994734227657318, -0.04374263808131218, 0.2972831428050995, 0.019797177985310555, -0.09201782941818237, 0.2879612147808075, 0.260174959897995, -0.3944226801395416, 0.06005598604679108, -0.38802921772003174, 0.01781018264591694, 0.027031274512410164, -0.30157163739204407, 0.30060210824012756, 0.2772766351699829, 0.08214299380779266, 0.004200658295303583, 0.31729164719581604, -0.004683692939579487, 0.2596944272518158, -0.1694335788488388, -0.09661421924829483, -0.13594210147857666, 0.004025369882583618, 0.25092554092407227, 0.328571617603302, -0.005053292028605938, 0.370881050825119, 0.06221829727292061, -0.10144202411174774, 0.29641738533973694, 0.2354956418275833, 0.7255522608757019, 0.4640224874019623, -0.1190437600016594, 0.24295824766159058, -0.21115684509277344, 0.10901755094528198, 0.09747583419084549, -0.2625778019428253, 0.1554887890815735, 0.2625451385974884, 0.18506905436515808, 0.09466615319252014, -0.15474587678909302, -0.21981872618198395, -0.287624329328537, 0.6263184547424316, -0.21281999349594116, 0.09534717351198196, -0.4532564580440521, -0.050077661871910095, 0.2427341789007187, -0.1345357745885849, 0.1381402611732483, -0.330047607421875, -0.1617695540189743, -0.24592655897140503, -0.1919931322336197, 0.12229998409748077, -0.14776037633419037, 0.12660008668899536, 0.11055881530046463, -0.22259987890720367, -0.3397717773914337, 0.23582220077514648, -0.4159999191761017, 0.1929883062839508, -0.3253123462200165, 0.31307080388069153, -0.01794205978512764, 0.29515644907951355, -0.03909087926149368, -0.03625946864485741, 0.5131917595863342, -0.3048460781574249, -0.07356160879135132, -0.07431360334157944, 0.5074620246887207, 0.27618709206581116, 0.17587190866470337, -0.2579193115234375, 0.13255675137043, 0.01192585751414299, -0.1675267219543457, -0.30012884736061096, 0.12818710505962372, -0.19765357673168182, -0.027515439316630363, -0.14490391314029694, 0.15020014345645905, 0.3254340887069702, 0.1393464207649231, -0.04366582632064819, -0.16099968552589417 ]
https://github.com/huggingface/datasets/issues/5427
Unable to download dataset id_clickbait
Thanks for reporting, @ilos-vigil. We have transferred this issue to the corresponding dataset on the Hugging Face Hub: https://huggingface.co/datasets/id_clickbait/discussions/1
### Describe the bug I tried to download dataset `id_clickbait`, but receive this error message. ``` FileNotFoundError: Couldn't find file at https://md-datasets-cache-zipfiles-prod.s3.eu-west-1.amazonaws.com/k42j7x2kpn-1.zip ``` When i open the link using browser, i got this XML data. ```xml <?xml version="1.0" encoding="UTF-8"?> <Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist</Message><BucketName>md-datasets-cache-zipfiles-prod</BucketName><RequestId>NVRM6VEEQD69SD00</RequestId><HostId>W/SPDxLGvlCGi0OD6d7mSDvfOAUqLAfvs9nTX50BkJrjMny+X9Jnqp/Li2lG9eTUuT4MUkAA2jjTfCrCiUmu7A==</HostId></Error> ``` ### Steps to reproduce the bug Code snippet: ``` from datasets import load_dataset load_dataset('id_clickbait', 'annotated') load_dataset('id_clickbait', 'raw') ``` Link to Kaggle notebook: https://www.kaggle.com/code/ilosvigil/bug-check-on-id-clickbait-dataset ### Expected behavior Successfully download and load `id_newspaper` dataset. ### Environment info - `datasets` version: 2.8.0 - Platform: Linux-5.15.65+-x86_64-with-debian-bullseye-sid - Python version: 3.7.12 - PyArrow version: 8.0.0 - Pandas version: 1.3.5
19
Unable to download dataset id_clickbait
[ -0.5453636646270752, 0.09606289118528366, -0.23784510791301727, 0.1996021568775177, 0.11198793351650238, 0.1456495225429535, 0.19641375541687012, 0.2758217453956604, 0.0012205714592710137, -0.09599366784095764, -0.23140376806259155, -0.13388460874557495, 0.10902632772922516, 0.3906491994857788, 0.13515406847000122, -0.028160013258457184, -0.04057709500193596, 0.0714615061879158, -0.31426024436950684, -0.08253856748342514, -0.17028287053108215, 0.138547882437706, -0.002688881941139698, 0.17973683774471283, 0.02353864163160324, -0.18718592822551727, -0.0901143029332161, 0.10297013819217682, -0.39452460408210754, -0.2436715066432953, 0.3535192310810089, 0.4246715009212494, 0.08565104752779007, 0.39073118567466736, -0.00010536023182794452, 0.06625296175479889, 0.21235807240009308, 0.025501707568764687, -0.3054673671722412, 0.008928090333938599, -0.27616965770721436, -0.22040875256061554, -0.06848163902759552, -0.123652383685112, 0.05166918411850929, -0.08093748241662979, 0.08234380185604095, 0.22042104601860046, 0.07509537041187286, 0.3031376898288727, 0.3260790705680847, 0.11765573918819427, 0.25184276700019836, -0.1660214513540268, 0.3736491799354553, 0.12433724105358124, -0.0527847521007061, 0.06202344223856926, 0.12464763224124908, 0.26868271827697754, 0.17996960878372192, 0.15890884399414062, 0.06998796761035919, 0.1877332627773285, -0.32898491621017456, -0.06676564365625381, 0.4319368302822113, -0.14705614745616913, 0.4967150092124939, 0.1475525051355362, 0.21038344502449036, -0.022680167108774185, -0.19562499225139618, 0.17940889298915863, 0.11602994054555893, -0.07740429788827896, 0.015014869160950184, 0.22465986013412476, -0.13420674204826355, 0.25996389985084534, -0.19017671048641205, -0.17099161446094513, -0.08371327817440033, -0.06531435251235962, -0.06947579979896545, -0.14415737986564636, -0.10196973383426666, 0.0922059714794159, 0.19036203622817993, -0.2188889980316162, 0.3128194808959961, 0.12320713698863983, -0.11619578301906586, -0.008337624371051788, 0.05226096138358116, 0.03650542348623276, 0.12119804322719574, 0.3380803167819977, 0.2688720226287842, 0.1489187479019165, -0.14963439106941223, -0.004740463104099035, -0.03685939684510231, -0.18467698991298676, 0.20100636780261993, -0.2795558273792267, -0.26274049282073975, 0.32304641604423523, 0.31578344106674194, 0.13746745884418488, -0.04443179816007614, 0.1739044189453125, -0.09004721790552139, 0.08311538398265839, 0.11244116723537445, 0.06690821051597595, 0.16524851322174072, -0.17012155055999756, -0.46024924516677856, 0.11290906369686127, -0.11045536398887634, -0.03143602982163429, -0.14863301813602448, 0.13998927175998688, -0.0026407816912978888, -0.031125856563448906, 0.03631193935871124, 0.01411698292940855, 0.050542332231998444, -0.3489342927932739, -0.4452804625034332, 0.18369552493095398, 0.023063065484166145, -0.29884499311447144, 0.29850518703460693, -0.2520751953125, 0.17799212038516998, -0.11683400720357895, -0.48336634039878845, 0.13438281416893005, -0.00536776427179575, -0.039816103875637054, -0.24429170787334442, 0.3127279281616211, 0.1062326654791832, 0.20586174726486206, -0.07112778723239899, 0.11999396979808807, -0.04213152080774307, 0.18859510123729706, -0.31393617391586304, -0.17284411191940308, 0.04982483386993408, 0.2766574025154114, -0.3883562386035919, -0.24266275763511658, 0.18528157472610474, 0.007809780538082123, -0.005517484620213509, 0.09357679635286331, -0.20212551951408386, -0.07800304889678955, 0.07745642960071564, -0.12006140500307083, 0.081015944480896, 0.48881635069847107, -0.3317883014678955, 0.02500450238585472, -0.1638493686914444, -0.3465643525123596, 0.19541840255260468, 0.030794918537139893, -0.1545812487602234, 0.27859413623809814, -0.26062220335006714, 0.030419956892728806, 0.33480849862098694, -0.5478255748748779, -0.5123716592788696, 0.08975016325712204, -0.3458379805088043, -0.17238938808441162, 0.13188354671001434, 0.07276694476604462, 0.14585670828819275, -0.06898900866508484, -0.07441925257444382, 0.32839086651802063, 0.11701153218746185, -0.07477857172489166, -0.09594066441059113, -0.38566097617149353, 0.2580719590187073, 0.1057613343000412, 0.03479122370481491, 0.20078934729099274, 0.22147101163864136, 0.17517954111099243, 0.12879829108715057, 0.28605711460113525, 0.012532951310276985, 0.0930170938372612, 0.18478450179100037, -0.29274874925613403, 0.03165492042899132, -0.19797629117965698, -0.19140902161598206, -0.23555424809455872, 0.25474628806114197, 0.17225630581378937, -0.4308509826660156, -0.12999458611011505, -0.763511061668396, 0.14167940616607666, -0.0647941455245018, -0.08436707407236099, 0.2657555937767029, 0.2758003771305084, 0.15656334161758423, 0.029971258714795113, 0.023229267448186874, 0.15238572657108307, 0.011888266541063786, -0.0012626710813492537, 0.24062801897525787, -0.07699427753686905, -0.21516740322113037, -0.03773936256766319, 0.34976404905319214, -0.06518183648586273, 0.06471151858568192, -0.1870645135641098, 0.1506233662366867, 0.3618529140949249, -0.01126120239496231, 0.01948651671409607, 0.7259959578514099, 0.09229184687137604, 0.14150993525981903, -0.42580920457839966, 0.016380008310079575, 0.2308044135570526, 0.11018070578575134, 0.053908199071884155, 0.16814379394054413, -0.00020961349946446717, -0.03203878924250603, -0.11932201683521271, 0.08405538648366928, -0.036593809723854065, 0.3961808979511261, 0.08796395361423492, 0.2410755753517151, -0.15464994311332703, 0.19412559270858765, 0.09188881516456604, 0.5275402665138245, -0.02690172754228115, -0.37417155504226685, 0.47184455394744873, 0.4913914203643799, -0.15752194821834564, 0.07457975298166275, -0.002128715394064784, 0.0240333154797554, -0.025754233822226524, -0.016591981053352356, 0.3003564774990082, 0.2096373438835144, 0.12172090262174606, 0.2585781216621399, -0.09171934425830841, -0.04269961640238762, -0.33157074451446533, 0.2550865411758423, -0.15498535335063934, -0.261223167181015, 0.03554050996899605, 0.08072065562009811, -0.1461026668548584, -0.18067437410354614, 0.05605441331863403, 0.29355114698410034, 0.4410252273082733, -0.18491385877132416, -0.10886149108409882, -0.2655845582485199, -0.2652698755264282, 0.2772620618343353, -0.07814604043960571, -0.003298150608316064, -0.30103135108947754, 0.03314436227083206, 0.20123028755187988, 0.023758724331855774, 0.05604510009288788, -0.4030706286430359, 0.17683662474155426, 0.3278581202030182, 0.12832649052143097, -0.11207343637943268, 0.01594279333949089, -0.2586882710456848, 0.23279814422130585, 0.03430522605776787, 0.16882671415805817, 0.25369879603385925, -0.3569953739643097, 0.32766732573509216, -0.4855497479438782, -0.015564033761620522, 0.23763443529605865, 0.011708198115229607, 0.2500465214252472, 0.3533618152141571, 0.6106446385383606, -0.30348026752471924, 0.005737621337175369, 0.18606868386268616, -0.18999475240707397, -0.1623317301273346, -0.015943754464387894, -0.14804528653621674, -0.03598663955926895, -0.12607435882091522, -0.26067498326301575, -0.5021979808807373, -0.1742255985736847, 0.09519273042678833, 0.16507001221179962, 0.14035162329673767, 0.2789703607559204, -0.13046559691429138, 0.12107573449611664, 0.43525394797325134, -0.04047827422618866, -0.3301735818386078, -0.3987348675727844, 0.531683087348938, -0.22473078966140747, -0.39755621552467346, 0.21543127298355103, 0.1573423147201538, 0.026856953278183937, 0.09346660226583481, -0.43251505494117737, 0.18612349033355713, -0.04972746595740318, 0.196264386177063, 0.15832877159118652, 0.22821931540966034, 0.048514433205127716, -0.06873668730258942, -0.19871646165847778, -0.1681731790304184, 0.17379648983478546, 0.34743157029151917, -0.17518675327301025, 0.22002746164798737, 0.04716162383556366, -0.2004978507757187, 0.06334195286035538, 0.5512661337852478, -0.08322807401418686, -0.13379229605197906, 0.2714889347553253, -0.1150575578212738, 0.24083112180233002, 0.11751297861337662, -0.4086723327636719, -0.40373584628105164, 0.13199466466903687, 0.08787824958562851, 0.02177140861749649, -0.06285516917705536, 0.0863746777176857, -0.30470114946365356, 0.005152675788849592, -0.3119886815547943, -0.30826815962791443, -0.2800459563732147, 0.37516337633132935, -0.006099925842136145, 0.2406928986310959, 0.12603478133678436, 0.042025770992040634, -0.27717623114585876, 0.3432539999485016, 0.17038774490356445, -0.018782123923301697, 0.2356911599636078, -0.1841125190258026, -0.2955157160758972, -0.28518614172935486, 0.19978049397468567, -0.19225767254829407, 0.33025693893432617, -0.09776829928159714, -0.0358281247317791, 0.22493897378444672, -0.1661427617073059, 0.5715070366859436, -0.5127497315406799, 0.5029948949813843, -0.04680291935801506, 0.2661377787590027, 0.09372183680534363, 0.03919632360339165, -0.47023606300354004, 0.141105055809021, 0.1372188776731491, -0.36141127347946167, -0.5619930624961853, 0.08196566253900528, 0.46874916553497314, -0.13947007060050964, 0.05192899331450462, 0.002848739270120859, -0.08733633905649185, -0.41484972834587097, -0.325792521238327, -0.09938403218984604, 0.10430695861577988, 0.17201711237430573, -0.15748140215873718, -0.026763729751110077, -0.075176902115345, -0.011839715763926506, 0.10232582688331604, -0.031332824379205704, 0.11994706839323044, 0.32586178183555603, 0.21114307641983032, 0.04796965420246124, -0.16215629875659943, 0.2060670703649521, 0.5267418622970581, -0.20265069603919983, -0.30936992168426514, 0.3204613924026489, -0.24504318833351135, -0.11165811121463776, 0.3284132778644562, -0.06403350085020065, -0.044831182807683945, 0.15889552235603333, -0.08226954936981201, 0.07743784040212631, 0.30142173171043396, 0.26835867762565613, -0.1951211392879486, -0.3131527900695801, -0.42773744463920593, 0.089364193379879, 0.02558867447078228, -0.07430867105722427, 0.06508283317089081, 0.2876119017601013, -0.03653638809919357, -0.2197490930557251, -0.14625363051891327, 1.0295251607894897, -0.021715015172958374, 0.022205227985978127, 0.11352116614580154, 0.03627829626202583, 0.3501512110233307, 0.07847955077886581, -0.16542360186576843, -0.21715757250785828, -0.004244429524987936, -0.08381815999746323, 0.005780017003417015, -0.06035607308149338, 0.0750696063041687, -0.09780580550432205, 0.0535413958132267, -0.22688326239585876, 0.40311580896377563, 0.08449976146221161, 0.37946969270706177, -0.16925880312919617, 0.10978011786937714, 0.14758825302124023, 0.2412194460630417, -0.3165239989757538, 0.25896328687667847, -0.08675999194383621, -0.18888221681118011, -0.0921592190861702, -0.07823200523853302, -0.2540287375450134, -0.039104171097278595, -0.18610592186450958, 0.2765597999095917, -0.5555304884910583, -0.2184135466814041, -0.435953289270401, -0.34622886776924133, 0.1711648404598236, 0.3115788698196411, -0.2248319536447525, 0.25758635997772217, -0.09775857627391815, -0.2912987172603607, 0.05778926610946655, 0.1764727532863617, 0.22906915843486786, -0.025162965059280396, -0.4243769347667694, 0.18895307183265686, 0.11631973832845688, -0.06586339324712753, 0.23243166506290436, -0.11374139040708542, -0.12138225138187408, -0.24293075501918793, -0.12768664956092834, -0.10318060219287872, -0.06470365822315216, -0.017662880942225456, 0.23431146144866943, 0.02209857851266861, 0.07107408344745636, -0.23717918992042542, 0.08154472708702087, -0.26427745819091797, -0.21549730002880096, 0.3955743908882141, 0.10687769204378128, -0.30745553970336914, 0.21354429423809052, 0.16516004502773285, -0.35466161370277405, -0.29598844051361084, 0.14009539783000946, -0.0380294993519783, -0.3209374248981476, -0.04297365993261337, -0.21683719754219055, 0.0005750873242504895, -0.016428321599960327, 0.4401474893093109, 0.17429038882255554, 0.0991227850317955, 0.10240723192691803, -0.4280393719673157, -0.12783153355121613, 0.05651509761810303, -0.03718912601470947, -0.044449444860219955, -0.050036389380693436, -0.19384555518627167, 0.13073503971099854, -0.08184735476970673, -0.42493003606796265, -0.030607448890805244, -0.12508459389209747, -0.18339791893959045, 0.2542988955974579, 0.06175466254353523, 0.21123887598514557, -0.03329068794846535, 0.2289840131998062, 0.19520671665668488, -0.3070278465747833, -0.3228720426559448, -0.021026654168963432, 0.06776967644691467, -0.03660249337553978, -0.14977075159549713, -0.06633629649877548, -0.39788955450057983, -0.24615304172039032, 0.34528663754463196, -0.0440201573073864, -0.05995391309261322, 0.1136716976761818, -0.0861370861530304, -0.03743698075413704, 0.15818271040916443, -0.00001257829717360437, 0.11411723494529724, 0.14357943832874298, 0.36885350942611694, -0.18189139664173126, 0.2054825872182846, 0.08271058648824692, -0.10222269594669342, 0.0749506875872612, 0.04524235427379608, 0.27400293946266174, 0.24675752222537994, 0.19228453934192657, -0.2531100809574127, -0.010470973327755928, 0.24849571287631989, 0.16058671474456787, 0.43436864018440247, -0.2231704592704773, -0.16602888703346252, 0.034240540117025375, 0.26056402921676636, -0.2252575308084488, 0.025042394176125526, 0.18654151260852814, -0.12260644137859344, -0.10661045461893082, 0.09323269873857498, 0.14339230954647064, -0.0941346138715744, 0.09466468542814255, 0.13622891902923584, 0.7244060635566711, -0.11416720598936081, 0.11905421316623688, 0.6782312989234924, -0.21509331464767456, 0.05337680131196976, 0.09065195918083191, 0.40595102310180664, -0.16357573866844177, 0.6504443883895874, -0.21155965328216553, -0.13327886164188385, 0.3493845462799072, -0.011820167303085327, 0.0029546646401286125, -0.053644128143787384, 0.2932186722755432, 0.32250672578811646, -0.16928617656230927, 0.11953100562095642, 0.19113945960998535, 0.5167836546897888, -0.22567084431648254, 0.0015283081447705626, -0.45596083998680115, 0.21720537543296814, 0.005365048069506884, 0.18611332774162292, -0.17678911983966827, -0.25981825590133667, -0.3429735600948334, 0.08830965310335159, -0.05936485901474953, -0.3270520567893982, 0.19363072514533997, 0.025477439165115356, 0.03457864001393318, -0.41156673431396484, -0.13157641887664795, -0.07676057517528534, 0.04696674272418022, -0.26621878147125244, 0.12077872455120087, 0.20774909853935242, -0.042064208537340164, 0.25924447178840637, 0.2509510815143585, 0.11361542344093323, -0.03186408802866936, -0.032811496406793594, -0.00599789759144187, 0.027498943731188774, -0.26970812678337097, -0.028926676139235497, 0.24051980674266815, 0.18618687987327576, -0.14994680881500244, 0.22085590660572052, 0.23133468627929688, -0.23094947636127472, -0.20141346752643585, 0.3816114366054535, 0.12731382250785828, 0.05665820464491844, -0.10384301841259003, -0.3448646366596222, 0.0225216131657362, 0.05082349479198456, -0.1976134479045868, -0.3705225884914398, -0.17119266092777252, 0.12245162576436996, -0.1955033242702484, 0.10034531354904175, -0.37941208481788635, 0.15270788967609406, -0.2523152232170105, 0.41433316469192505, 0.35587361454963684, 0.10151492804288864, -0.008752917870879173, -0.12640996277332306, -0.5083559155464172, 0.19542989134788513, -0.0029779765754938126, -0.2744296193122864, -0.08584403246641159, 0.060437608510255814, -0.022791145369410515, 0.24876008927822113, 0.22332638502120972, 0.22213657200336456, 0.1796931028366089, 0.18736524879932404, -0.17890819907188416, -0.058152586221694946, -0.14023981988430023, 0.04083409160375595, -0.154439315199852, -0.1378481090068817, 0.2792675197124481, -0.25585848093032837, 0.13253863155841827, -0.12171897292137146, -0.3544274568557739, 0.0806635171175003, 0.036780934780836105, 0.3915831744670868, -0.0061246431432664394, 0.5529208779335022, -0.1389843076467514, -0.05756624788045883, -0.20335528254508972, -0.292830228805542, 0.013845513574779034, 0.41869866847991943, 0.07554422318935394, -0.25127875804901123, 0.03408098593354225, -0.10266754031181335, 0.05122597515583038, 0.059414345771074295, -0.004933342803269625, 0.2941940426826477, -0.27774474024772644, -0.09377375990152359, -0.20939989387989044, -0.0532231479883194, -0.029956618323922157, -0.2515599727630615, 0.007042201701551676, -0.05718068405985832, -0.1572534292936325, -0.4465586543083191, 0.29418468475341797, 0.030286578461527824, -0.34126952290534973, -0.1494300365447998, 0.23367434740066528, 0.1242179125547409, 0.06622960418462753, -0.5032973885536194, 0.08191479742527008, 0.10794515162706375, -0.12218737602233887, -0.17661195993423462, 0.3478917181491852, -0.07212037593126297, 0.04841352254152298, 0.07983651012182236, 0.5120576620101929, 0.14788243174552917, -0.3240532875061035, 0.045270416885614395, 0.03892480209469795 ]
https://github.com/huggingface/datasets/issues/5425
Sort on multiple keys with datasets.Dataset.sort()
Hi! `Dataset.sort` calls `df.sort_values` internally, and `df.sort_values` brings all the "sort" columns in memory, so sorting on multiple keys could be very expensive. This makes me think that maybe we can replace `df.sort_values` with `pyarrow.compute.sort_indices` - the latter can also sort on multiple keys and currently loads the data into memory; however, there is a plan to eventually implement "memory-map" friendly kernels for the Arrow compute ops (using the Acero execution engine). So to address this issue, you should replace `df.sort_values` with `pyarrow.compute.sort_indices` in `Dataset.sort` and adjust the signature of this function (deprecate the `kind` parameter, etc.). PS: Feel free to ping us if you need some additional help/pointers
### Feature request From discussion on forum: https://discuss.huggingface.co/t/datasets-dataset-sort-does-not-preserve-ordering/29065/1 `sort()` does not preserve ordering, and it does not support sorting on multiple columns, nor a key function. The suggested solution: > ... having something similar to pandas and be able to specify multiple columns for sorting. We’re already using pandas under the hood to do the sorting in datasets. The suggested workaround: > convert your dataset to pandas and use `df.sort_values()` ### Motivation Preserved ordering when sorting is very handy when one needs to sort on multiple columns, A and B, so that e.g. whenever A is equal for two or more rows, B is kept sorted. Having a parameter to do this in 🤗datasets would be cleaner than going through pandas and back, and it wouldn't add much complexity to the library. Alternatives: - the possibility to specify multiple keys to sort by with decreasing priority (suggested solution), - the ability to provide a key function for sorting, so that one can manually specify the sorting criteria. ### Your contribution I'll be happy to contribute by submitting a PR. Will get documented on `CONTRIBUTING.MD`. Would love to get thoughts on this, if anyone has anything to add.
109
Sort on multiple keys with datasets.Dataset.sort()
[ 0.028741464018821716, -0.09899337589740753, -0.2973214089870453, 0.11221349984407425, 0.1764691323041916, 0.08357195556163788, 0.06119823083281517, 0.2558813989162445, -0.13195225596427917, 0.04995827376842499, -0.10002277791500092, 0.22852276265621185, 0.005976022221148014, 0.11916109919548035, 0.1299404352903366, -0.1751485913991928, -0.052675873041152954, 0.07647618651390076, 0.10694260150194168, -0.037278253585100174, -0.10407478362321854, -0.018843917176127434, -0.36189672350883484, 0.022627171128988266, 0.16309456527233124, -0.211319699883461, -0.13150985538959503, 0.06319349259138107, -0.20336928963661194, -0.39403992891311646, -0.023737367242574692, 0.3600752353668213, -0.2311311960220337, 0.2830202877521515, -0.00009829093323787674, -0.027034558355808258, -0.15511251986026764, -0.06828892976045609, -0.14293275773525238, -0.05293061584234238, -0.13685062527656555, 0.1365538090467453, -0.31148025393486023, -0.16597580909729004, -0.26916879415512085, -0.517481803894043, 0.07312311977148056, -0.3936796188354492, 0.21545954048633575, 0.11239194869995117, 0.30136850476264954, 0.21242313086986542, 0.08837921172380447, -0.020500464364886284, 0.15879520773887634, -0.038167804479599, 0.03924916312098503, -0.27118930220603943, 0.14484061300754547, 0.15542326867580414, -0.042367320507764816, 0.17660818994045258, -0.06745560467243195, -0.20266829431056976, 0.27615466713905334, -0.04900844767689705, -0.1744646579027176, 0.07352420687675476, 0.276804655790329, -0.048764731734991074, 0.42820027470588684, -0.3786011040210724, -0.3875385820865631, -0.18187670409679413, 0.1576341986656189, 0.041407711803913116, 0.01363010611385107, -0.11205583065748215, 0.1906524896621704, -0.18286876380443573, 0.0253467820584774, -0.04230644553899765, -0.10334239900112152, 0.33909863233566284, -0.21739134192466736, 0.25068655610084534, -0.14904356002807617, -0.05559879541397095, 0.2212914377450943, -0.31704574823379517, 0.11758691817522049, -0.48928478360176086, 0.07492232322692871, 0.12360358983278275, -0.3871307075023651, -0.23457695543766022, 0.41621190309524536, 0.3631003499031067, 0.20420928299427032, -0.23175935447216034, -0.09831859171390533, 0.03442925214767456, 0.11145657300949097, -0.07862799614667892, 0.4601077437400818, 0.23155617713928223, 0.4143107533454895, 0.2871588170528412, 0.10558782517910004, -0.15301452577114105, -0.08470325917005539, 0.008258804678916931, 0.23843777179718018, -0.4598367214202881, -0.11582072824239731, 0.2984207272529602, -0.0024685747921466827, -0.01222578901797533, -0.07282502204179764, -0.13710127770900726, 0.2499946653842926, -0.11843417584896088, 0.32767945528030396, 0.4415939152240753, 0.15942507982254028, 0.015413908287882805, -0.30153194069862366, 0.05728483200073242, 0.04334966465830803, 0.2917996346950531, -0.3173701763153076, -0.016046281903982162, 0.11875352263450623, -0.18779811263084412, 0.06037387251853943, -0.09712766855955124, -0.16569070518016815, 0.122409388422966, 0.1567566990852356, -0.10008503496646881, 0.08057725429534912, 0.06857022643089294, 0.2257465422153473, 0.29695039987564087, 0.11611581593751907, 0.1641055941581726, -0.025623725727200508, -0.12034722417593002, -0.25645431876182556, 0.205649733543396, -0.3393760025501251, -0.20160476863384247, 0.2391362488269806, 0.2643216848373413, 0.12448668479919434, 0.09156861156225204, -0.2836962938308716, 0.10045425593852997, 0.2931644320487976, -0.2490716278553009, -0.1282299906015396, 0.10369186848402023, -0.1263352930545807, -0.1338959038257599, -0.07697287946939468, -0.01695343852043152, -0.23882731795310974, 0.013437679037451744, -0.2867739200592041, 0.0458216592669487, -0.14717240631580353, -0.022884326055645943, -0.1372058242559433, 0.1682179868221283, 0.08400566130876541, 0.4115127623081207, 0.5246119499206543, -0.25035303831100464, -0.5486193299293518, 0.24931985139846802, -0.12953656911849976, -0.316114604473114, 0.16261045634746552, 0.36588165163993835, 0.21764063835144043, -0.1080687940120697, 0.17386585474014282, 0.09656177461147308, 0.06566561013460159, 0.1413278877735138, 0.05509106442332268, 0.026691755279898643, 0.04763496667146683, 0.09746909886598587, 0.18258927762508392, -0.18801520764827728, 0.18442866206169128, -0.12867653369903564, 0.07147156447172165, -0.17986805737018585, -0.2552776038646698, 0.2932296693325043, -0.07146204262971878, -0.04671154171228409, 0.11469095200300217, -0.1888485997915268, -0.2776067554950714, 0.09598945081233978, 0.21691830456256866, -0.19637557864189148, -0.3188058137893677, -0.1703096330165863, -0.15814805030822754, 0.003167852759361267, -0.2981880307197571, 0.43992531299591064, 0.30934813618659973, 0.04590253904461861, -0.14083395898342133, -0.09301429986953735, -0.10139147192239761, 0.07767325639724731, 0.14301806688308716, -0.13094200193881989, -0.18788938224315643, 0.30042821168899536, -0.25594988465309143, 0.31301772594451904, 0.10518334805965424, -0.07078729569911957, 0.2558874189853668, 0.10056102275848389, 0.12523286044597626, 0.3052782714366913, 0.046064846217632294, -0.17728833854198456, 0.13048811256885529, 0.07967263460159302, -0.02715574949979782, 0.14838431775569916, 0.08697950839996338, 0.1438976377248764, -0.011832283809781075, 0.06474629044532776, -0.5371254086494446, 0.6956678628921509, -0.2035532146692276, 0.19834968447685242, 0.15104900300502777, -0.05159931257367134, -0.04776904359459877, 0.26706406474113464, 0.022406242787837982, -0.23311270773410797, 0.18953894078731537, 0.21901406347751617, -0.024510568007826805, 0.10708460211753845, -0.11982258409261703, 0.41455453634262085, 0.6199867129325867, 0.03352299705147743, 0.27068352699279785, -0.12812234461307526, 0.12096802890300751, 0.12044632434844971, 0.09573175758123398, 0.32039573788642883, -0.00476019037887454, 0.36533504724502563, 0.12256555259227753, -0.2140568345785141, -0.004775006789714098, -0.010725472122430801, -0.040854353457689285, 0.03006882406771183, -0.28911444544792175, 0.3847918212413788, 0.22437109053134918, 0.023196067661046982, -0.4351916015148163, 0.019098928198218346, 0.2587398886680603, -0.002195655135437846, -0.25597551465034485, -0.06115487217903137, -0.23312318325042725, -0.23552662134170532, 0.2014453411102295, -0.028508152812719345, -0.2556595206260681, -0.20508043467998505, 0.2772729992866516, -0.18023738265037537, -0.020554974675178528, 0.058181796222925186, 0.06811882555484772, 0.11395329982042313, 0.29818376898765564, -0.04306061565876007, 0.06895627826452255, -0.1549319475889206, 0.0038211180362850428, 0.1969866007566452, 0.19441509246826172, 0.18841761350631714, 0.4552612602710724, -0.023151539266109467, -0.10380826890468597, -0.0008603439200669527, -0.3883145749568939, -0.16494590044021606, -0.16007906198501587, -0.04555778577923775, 0.10475696623325348, 0.07942239940166473, -0.170744851231575, -0.014722604304552078, 0.07637723535299301, 0.239674910902977, -0.2990134060382843, 0.18565014004707336, 0.07611586898565292, -0.24249188601970673, -0.22554217278957367, -0.31050577759742737, 0.1628037840127945, 0.04459526762366295, 0.02515130117535591, -0.009111699648201466, 0.32996299862861633, -0.2689761519432068, -0.06573230773210526, -0.08190502971410751, -0.09226939082145691, -0.015839165076613426, -0.11080092936754227, 0.0911756157875061, 0.26182058453559875, -0.017259590327739716, -0.11627946048974991, -0.17516663670539856, 0.018687555566430092, -0.37253737449645996, 0.096438929438591, -0.08320402354001999, -0.2570739686489105, -0.11962383985519409, 0.2844480574131012, -0.023050813004374504, 0.31526288390159607, 0.3632940351963043, 0.17984257638454437, -0.15952637791633606, -0.2913755476474762, -0.212080717086792, -0.12867677211761475, 0.03576914593577385, 0.06076393648982048, -0.222672238945961, 0.37091925740242004, 0.4100162088871002, 0.314433217048645, -0.31595489382743835, 0.05251911282539368, 0.09986817091703415, 0.0971875935792923, 0.1581433266401291, -0.026691561564803123, -0.3397607207298279, 0.07663605362176895, 0.26961347460746765, 0.2836642265319824, 0.21160617470741272, 0.1588263064622879, -0.004899116232991219, 0.05002809688448906, 0.023800497874617577, -0.16895371675491333, -0.03600868210196495, -0.10271711647510529, -0.09049990773200989, 0.0025359669234603643, 0.17975661158561707, 0.1987525075674057, -0.4322522282600403, -0.01353919692337513, -0.1523052304983139, -0.09588416665792465, -0.2775111496448517, -0.1532660275697708, -0.4073219299316406, -0.0225144661962986, -0.32482507824897766, 0.05860809236764908, 0.24598075449466705, -0.06660757958889008, 0.12772241234779358, 0.20894786715507507, -0.07537244260311127, -0.4535475969314575, 0.7264634966850281, -0.03479468449950218, 0.2244250476360321, 0.1056964322924614, -0.04653359577059746, -0.2877999544143677, 0.386326402425766, -0.0923352986574173, 0.3816564679145813, -0.3733280599117279, 0.4020630717277527, -0.3640495836734772, -0.11360924690961838, -0.2745121121406555, 0.06633970886468887, -0.0886177271604538, -0.3054408133029938, -0.23281055688858032, -0.1869032084941864, -0.056929413229227066, 0.1902729868888855, 0.04687241092324257, 0.0898398756980896, -0.20126931369304657, -0.1646491438150406, -0.11180843412876129, -0.14261658489704132, -0.042835865169763565, -0.043210916221141815, 0.32821163535118103, 0.306610643863678, -0.0194955226033926, 0.17154859006404877, 0.09807342290878296, 0.05853812396526337, 0.06522303074598312, 0.11859067529439926, -0.12706686556339264, -0.23855140805244446, -0.057969171553850174, -0.1155557632446289, 0.12367766350507736, -0.23189283907413483, 0.055988021194934845, 0.08753781020641327, 0.06897284090518951, 0.28997406363487244, 0.07451390475034714, 0.4161418676376343, 0.04203232750296593, -0.31354185938835144, -0.34835514426231384, 0.5198854207992554, -0.03438209369778633, -0.271411657333374, 0.30008918046951294, 0.5188669562339783, -0.34985294938087463, -0.10039042681455612, 0.12252308428287506, 0.45780670642852783, -0.25626036524772644, 0.15132583677768707, 0.08422946184873581, -0.16238678991794586, 0.0760197639465332, -0.15231524407863617, 0.3884741961956024, -0.3539924621582031, -0.38853025436401367, 0.0028728952165693045, 0.0030920403078198433, -0.07987355440855026, 0.37980255484580994, -0.20288437604904175, 0.19962027668952942, 0.030966708436608315, 0.1436246931552887, -0.21247147023677826, 0.1080198884010315, 0.02416945993900299, 0.06602545082569122, -0.413293719291687, 0.258748859167099, -0.014453104697167873, -0.22002233564853668, -0.1026776134967804, 0.15408167243003845, 0.3859541416168213, -0.34680116176605225, 0.020468860864639282, -0.1017046645283699, -0.21351243555545807, 0.2738752067089081, -0.28672537207603455, -0.05902617797255516, 0.0654316172003746, 0.3275730609893799, 0.25089380145072937, 0.2156902253627777, 0.18395817279815674, 0.17460931837558746, 0.09350919723510742, 0.4132477939128876, -0.03079063817858696, -0.12332703173160553, 0.0029667324852198362, -0.09036454558372498, -0.05656089633703232, -0.30132967233657837, 0.3779541850090027, -0.4599745571613312, -0.10072620958089828, 0.23339299857616425, -0.1467258632183075, 0.005664231721311808, 0.033732131123542786, 0.24836429953575134, 0.10704982280731201, -0.2621464729309082, 0.27916207909584045, 0.017606908455491066, 0.021781371906399727, 0.3856351673603058, -0.2298927903175354, 0.1456385850906372, 0.08664967119693756, 0.42799511551856995, 0.19120997190475464, 0.08677171170711517, 0.22853656113147736, 0.13159969449043274, -0.46108412742614746, -0.3208995759487152, -0.10690692067146301, 0.10199175029993057, 0.1377643495798111, 0.2878592908382416, -0.17465543746948242, -0.026994826272130013, 0.12229665368795395, 0.1870105117559433, -0.14917251467704773, -0.029341941699385643, 0.02487516589462757, -0.13401098549365997, 0.06822408735752106, 0.047108255326747894, 0.30334365367889404, 0.22584572434425354, 0.015977801755070686, 0.044641077518463135, -0.0853179469704628, -0.01034301333129406, -0.41374990344047546, 0.011657039634883404, 0.024023350328207016, 0.21102935075759888, 0.11200687289237976, 0.07604470103979111, -0.13820010423660278, -0.033245693892240524, 0.29385697841644287, -0.2629936933517456, -0.1742492914199829, -0.4430278539657593, 0.059456586837768555, -0.005820879712700844, -0.08289095759391785, 0.230892613530159, 0.021758709102869034, -0.34936586022377014, -0.21420831978321075, -0.1783481240272522, 0.2030445635318756, 0.2989426851272583, -0.0071336147375404835, 0.35147884488105774, 0.2581545114517212, -0.0035942327231168747, 0.23585103452205658, 0.19561876356601715, 0.06273454427719116, -0.45853444933891296, 0.15426231920719147, 0.44000306725502014, -0.0585353821516037, 0.07727967947721481, -0.07029365748167038, 0.0784812718629837, 0.2070714235305786, 0.06912847608327866, 0.06716207414865494, -0.38276374340057373, -0.2325223684310913, 0.35732418298721313, 0.5423648953437805, 0.40724581480026245, 0.009469843469560146, -0.11992395669221878, -0.18630734086036682, 0.2812197804450989, -0.423431932926178, -0.3921651542186737, 0.22317716479301453, 0.2112451046705246, 0.04564488306641579, -0.11524758487939835, -0.26262569427490234, 0.11134424805641174, 0.03918910026550293, 0.10051245242357254, -0.06835640221834183, -0.15422244369983673, 0.3816716969013214, 0.34196603298187256, 0.11520474404096603, -0.248460054397583, 0.09961001574993134, -0.0036607254296541214, -0.19121837615966797, 0.5780709981918335, 0.013111012056469917, 0.31486907601356506, 0.0862170159816742, -0.22058995068073273, -0.013476642780005932, -0.2652890086174011, 0.29852157831192017, 0.11329348385334015, 0.049394916743040085, -0.09555695205926895, 0.4409901201725006, -0.03224068507552147, 0.003891852218657732, -0.23988521099090576, -0.3835207223892212, 0.03165460377931595, -0.10211504995822906, -0.19804491102695465, -0.06268967688083649, -0.17793291807174683, 0.08181717991828918, -0.004636696074157953, -0.10522919148206711, -0.04847212880849838, 0.14905807375907898, -0.06979266554117203, 0.2193257361650467, -0.7102015614509583, 0.35685229301452637, -0.015394576825201511, 0.21962790191173553, -0.006895689759403467, 0.027445456013083458, 0.19851267337799072, 0.13520324230194092, 0.07749417424201965, -0.1274237483739853, 0.06324156373739243, -0.08694829046726227, 0.017552901059389114, -0.01817288063466549, -0.04402824118733406, -0.1820732206106186, -0.06733627617359161, -0.2454107105731964, -0.29899415373802185, 0.19106021523475647, 0.4642946422100067, 0.257941335439682, -0.21172159910202026, 0.21024756133556366, 0.1895163655281067, -0.0018318326910957694, -0.04670119285583496, 0.007600108161568642, -0.3009836971759796, -0.3384607136249542, 0.06299804151058197, 0.11697909981012344, -0.027359738945961, -0.39263486862182617, 0.037846047431230545, 0.008233655244112015, -0.0022859221789985895, -0.46609991788864136, 0.190652534365654, 0.036641042679548264, 0.3921414613723755, 0.13660885393619537, 0.08760827034711838, -0.19138385355472565, -0.12887336313724518, -0.6261276006698608, -0.07745063304901123, 0.1408565193414688, -0.027239365503191948, -0.06064930185675621, 0.23845764994621277, 0.05874178186058998, -0.2467811405658722, 0.28996142745018005, -0.4334382116794586, 0.026411909610033035, 0.02390831522643566, -0.3930666744709015, -0.05343015119433403, -0.013798928819596767, -0.03626582399010658, -0.08431702852249146, -0.3480244576931, -0.14173582196235657, -0.10429704934358597, 0.27614304423332214, -0.3093971610069275, 0.3391559422016144, -0.1596834361553192, -0.21434177458286285, -0.12942498922348022, 0.02752583660185337, 0.48605242371559143, 0.04348034784197807, 0.09970365464687347, 0.1253850907087326, 0.02560342475771904, -0.3106209337711334, 0.10070642083883286, 0.15451855957508087, 0.2941522002220154, -0.11882753670215607, -0.010397731326520443, 0.1382458209991455, -0.06621773540973663, 0.1894260197877884, 0.14562833309173584, -0.09207150340080261, 0.15960288047790527, -0.03433007001876831, -0.05577749386429787, -0.18556027114391327, -0.007284427527338266, 0.006871192716062069, 0.1802998036146164, 0.20399022102355957, -0.2509247660636902, 0.0992012694478035, -0.23715899884700775, -0.24451328814029694, -0.12316786497831345, 0.08535350114107132, 0.24743087589740753, -0.19652345776557922, 0.16342605650424957, -0.006512903142720461, 0.3367505967617035, 0.14198456704616547, -0.07453657686710358, 0.3665940761566162, -0.2272612750530243, -0.041563794016838074, -0.10113099962472916, -0.04538671299815178, 0.08844989538192749, -0.4045807421207428, -0.05784080550074577, -0.21537308394908905 ]
https://github.com/huggingface/datasets/issues/5425
Sort on multiple keys with datasets.Dataset.sort()
@mariosasko If I understand the code right, using `pyarrow.compute.sort_indices` would also require changes to the `select` method if it is meant to sort multiple keys. That's because `select` only accepts 1D input for `indices`, not an iterable or similar which would be required for multiple keys unless you want some looping over selects. Doesn't seem that straight-forward but I might be missing something here...
### Feature request From discussion on forum: https://discuss.huggingface.co/t/datasets-dataset-sort-does-not-preserve-ordering/29065/1 `sort()` does not preserve ordering, and it does not support sorting on multiple columns, nor a key function. The suggested solution: > ... having something similar to pandas and be able to specify multiple columns for sorting. We’re already using pandas under the hood to do the sorting in datasets. The suggested workaround: > convert your dataset to pandas and use `df.sort_values()` ### Motivation Preserved ordering when sorting is very handy when one needs to sort on multiple columns, A and B, so that e.g. whenever A is equal for two or more rows, B is kept sorted. Having a parameter to do this in 🤗datasets would be cleaner than going through pandas and back, and it wouldn't add much complexity to the library. Alternatives: - the possibility to specify multiple keys to sort by with decreasing priority (suggested solution), - the ability to provide a key function for sorting, so that one can manually specify the sorting criteria. ### Your contribution I'll be happy to contribute by submitting a PR. Will get documented on `CONTRIBUTING.MD`. Would love to get thoughts on this, if anyone has anything to add.
64
Sort on multiple keys with datasets.Dataset.sort()
[ 0.028741464018821716, -0.09899337589740753, -0.2973214089870453, 0.11221349984407425, 0.1764691323041916, 0.08357195556163788, 0.06119823083281517, 0.2558813989162445, -0.13195225596427917, 0.04995827376842499, -0.10002277791500092, 0.22852276265621185, 0.005976022221148014, 0.11916109919548035, 0.1299404352903366, -0.1751485913991928, -0.052675873041152954, 0.07647618651390076, 0.10694260150194168, -0.037278253585100174, -0.10407478362321854, -0.018843917176127434, -0.36189672350883484, 0.022627171128988266, 0.16309456527233124, -0.211319699883461, -0.13150985538959503, 0.06319349259138107, -0.20336928963661194, -0.39403992891311646, -0.023737367242574692, 0.3600752353668213, -0.2311311960220337, 0.2830202877521515, -0.00009829093323787674, -0.027034558355808258, -0.15511251986026764, -0.06828892976045609, -0.14293275773525238, -0.05293061584234238, -0.13685062527656555, 0.1365538090467453, -0.31148025393486023, -0.16597580909729004, -0.26916879415512085, -0.517481803894043, 0.07312311977148056, -0.3936796188354492, 0.21545954048633575, 0.11239194869995117, 0.30136850476264954, 0.21242313086986542, 0.08837921172380447, -0.020500464364886284, 0.15879520773887634, -0.038167804479599, 0.03924916312098503, -0.27118930220603943, 0.14484061300754547, 0.15542326867580414, -0.042367320507764816, 0.17660818994045258, -0.06745560467243195, -0.20266829431056976, 0.27615466713905334, -0.04900844767689705, -0.1744646579027176, 0.07352420687675476, 0.276804655790329, -0.048764731734991074, 0.42820027470588684, -0.3786011040210724, -0.3875385820865631, -0.18187670409679413, 0.1576341986656189, 0.041407711803913116, 0.01363010611385107, -0.11205583065748215, 0.1906524896621704, -0.18286876380443573, 0.0253467820584774, -0.04230644553899765, -0.10334239900112152, 0.33909863233566284, -0.21739134192466736, 0.25068655610084534, -0.14904356002807617, -0.05559879541397095, 0.2212914377450943, -0.31704574823379517, 0.11758691817522049, -0.48928478360176086, 0.07492232322692871, 0.12360358983278275, -0.3871307075023651, -0.23457695543766022, 0.41621190309524536, 0.3631003499031067, 0.20420928299427032, -0.23175935447216034, -0.09831859171390533, 0.03442925214767456, 0.11145657300949097, -0.07862799614667892, 0.4601077437400818, 0.23155617713928223, 0.4143107533454895, 0.2871588170528412, 0.10558782517910004, -0.15301452577114105, -0.08470325917005539, 0.008258804678916931, 0.23843777179718018, -0.4598367214202881, -0.11582072824239731, 0.2984207272529602, -0.0024685747921466827, -0.01222578901797533, -0.07282502204179764, -0.13710127770900726, 0.2499946653842926, -0.11843417584896088, 0.32767945528030396, 0.4415939152240753, 0.15942507982254028, 0.015413908287882805, -0.30153194069862366, 0.05728483200073242, 0.04334966465830803, 0.2917996346950531, -0.3173701763153076, -0.016046281903982162, 0.11875352263450623, -0.18779811263084412, 0.06037387251853943, -0.09712766855955124, -0.16569070518016815, 0.122409388422966, 0.1567566990852356, -0.10008503496646881, 0.08057725429534912, 0.06857022643089294, 0.2257465422153473, 0.29695039987564087, 0.11611581593751907, 0.1641055941581726, -0.025623725727200508, -0.12034722417593002, -0.25645431876182556, 0.205649733543396, -0.3393760025501251, -0.20160476863384247, 0.2391362488269806, 0.2643216848373413, 0.12448668479919434, 0.09156861156225204, -0.2836962938308716, 0.10045425593852997, 0.2931644320487976, -0.2490716278553009, -0.1282299906015396, 0.10369186848402023, -0.1263352930545807, -0.1338959038257599, -0.07697287946939468, -0.01695343852043152, -0.23882731795310974, 0.013437679037451744, -0.2867739200592041, 0.0458216592669487, -0.14717240631580353, -0.022884326055645943, -0.1372058242559433, 0.1682179868221283, 0.08400566130876541, 0.4115127623081207, 0.5246119499206543, -0.25035303831100464, -0.5486193299293518, 0.24931985139846802, -0.12953656911849976, -0.316114604473114, 0.16261045634746552, 0.36588165163993835, 0.21764063835144043, -0.1080687940120697, 0.17386585474014282, 0.09656177461147308, 0.06566561013460159, 0.1413278877735138, 0.05509106442332268, 0.026691755279898643, 0.04763496667146683, 0.09746909886598587, 0.18258927762508392, -0.18801520764827728, 0.18442866206169128, -0.12867653369903564, 0.07147156447172165, -0.17986805737018585, -0.2552776038646698, 0.2932296693325043, -0.07146204262971878, -0.04671154171228409, 0.11469095200300217, -0.1888485997915268, -0.2776067554950714, 0.09598945081233978, 0.21691830456256866, -0.19637557864189148, -0.3188058137893677, -0.1703096330165863, -0.15814805030822754, 0.003167852759361267, -0.2981880307197571, 0.43992531299591064, 0.30934813618659973, 0.04590253904461861, -0.14083395898342133, -0.09301429986953735, -0.10139147192239761, 0.07767325639724731, 0.14301806688308716, -0.13094200193881989, -0.18788938224315643, 0.30042821168899536, -0.25594988465309143, 0.31301772594451904, 0.10518334805965424, -0.07078729569911957, 0.2558874189853668, 0.10056102275848389, 0.12523286044597626, 0.3052782714366913, 0.046064846217632294, -0.17728833854198456, 0.13048811256885529, 0.07967263460159302, -0.02715574949979782, 0.14838431775569916, 0.08697950839996338, 0.1438976377248764, -0.011832283809781075, 0.06474629044532776, -0.5371254086494446, 0.6956678628921509, -0.2035532146692276, 0.19834968447685242, 0.15104900300502777, -0.05159931257367134, -0.04776904359459877, 0.26706406474113464, 0.022406242787837982, -0.23311270773410797, 0.18953894078731537, 0.21901406347751617, -0.024510568007826805, 0.10708460211753845, -0.11982258409261703, 0.41455453634262085, 0.6199867129325867, 0.03352299705147743, 0.27068352699279785, -0.12812234461307526, 0.12096802890300751, 0.12044632434844971, 0.09573175758123398, 0.32039573788642883, -0.00476019037887454, 0.36533504724502563, 0.12256555259227753, -0.2140568345785141, -0.004775006789714098, -0.010725472122430801, -0.040854353457689285, 0.03006882406771183, -0.28911444544792175, 0.3847918212413788, 0.22437109053134918, 0.023196067661046982, -0.4351916015148163, 0.019098928198218346, 0.2587398886680603, -0.002195655135437846, -0.25597551465034485, -0.06115487217903137, -0.23312318325042725, -0.23552662134170532, 0.2014453411102295, -0.028508152812719345, -0.2556595206260681, -0.20508043467998505, 0.2772729992866516, -0.18023738265037537, -0.020554974675178528, 0.058181796222925186, 0.06811882555484772, 0.11395329982042313, 0.29818376898765564, -0.04306061565876007, 0.06895627826452255, -0.1549319475889206, 0.0038211180362850428, 0.1969866007566452, 0.19441509246826172, 0.18841761350631714, 0.4552612602710724, -0.023151539266109467, -0.10380826890468597, -0.0008603439200669527, -0.3883145749568939, -0.16494590044021606, -0.16007906198501587, -0.04555778577923775, 0.10475696623325348, 0.07942239940166473, -0.170744851231575, -0.014722604304552078, 0.07637723535299301, 0.239674910902977, -0.2990134060382843, 0.18565014004707336, 0.07611586898565292, -0.24249188601970673, -0.22554217278957367, -0.31050577759742737, 0.1628037840127945, 0.04459526762366295, 0.02515130117535591, -0.009111699648201466, 0.32996299862861633, -0.2689761519432068, -0.06573230773210526, -0.08190502971410751, -0.09226939082145691, -0.015839165076613426, -0.11080092936754227, 0.0911756157875061, 0.26182058453559875, -0.017259590327739716, -0.11627946048974991, -0.17516663670539856, 0.018687555566430092, -0.37253737449645996, 0.096438929438591, -0.08320402354001999, -0.2570739686489105, -0.11962383985519409, 0.2844480574131012, -0.023050813004374504, 0.31526288390159607, 0.3632940351963043, 0.17984257638454437, -0.15952637791633606, -0.2913755476474762, -0.212080717086792, -0.12867677211761475, 0.03576914593577385, 0.06076393648982048, -0.222672238945961, 0.37091925740242004, 0.4100162088871002, 0.314433217048645, -0.31595489382743835, 0.05251911282539368, 0.09986817091703415, 0.0971875935792923, 0.1581433266401291, -0.026691561564803123, -0.3397607207298279, 0.07663605362176895, 0.26961347460746765, 0.2836642265319824, 0.21160617470741272, 0.1588263064622879, -0.004899116232991219, 0.05002809688448906, 0.023800497874617577, -0.16895371675491333, -0.03600868210196495, -0.10271711647510529, -0.09049990773200989, 0.0025359669234603643, 0.17975661158561707, 0.1987525075674057, -0.4322522282600403, -0.01353919692337513, -0.1523052304983139, -0.09588416665792465, -0.2775111496448517, -0.1532660275697708, -0.4073219299316406, -0.0225144661962986, -0.32482507824897766, 0.05860809236764908, 0.24598075449466705, -0.06660757958889008, 0.12772241234779358, 0.20894786715507507, -0.07537244260311127, -0.4535475969314575, 0.7264634966850281, -0.03479468449950218, 0.2244250476360321, 0.1056964322924614, -0.04653359577059746, -0.2877999544143677, 0.386326402425766, -0.0923352986574173, 0.3816564679145813, -0.3733280599117279, 0.4020630717277527, -0.3640495836734772, -0.11360924690961838, -0.2745121121406555, 0.06633970886468887, -0.0886177271604538, -0.3054408133029938, -0.23281055688858032, -0.1869032084941864, -0.056929413229227066, 0.1902729868888855, 0.04687241092324257, 0.0898398756980896, -0.20126931369304657, -0.1646491438150406, -0.11180843412876129, -0.14261658489704132, -0.042835865169763565, -0.043210916221141815, 0.32821163535118103, 0.306610643863678, -0.0194955226033926, 0.17154859006404877, 0.09807342290878296, 0.05853812396526337, 0.06522303074598312, 0.11859067529439926, -0.12706686556339264, -0.23855140805244446, -0.057969171553850174, -0.1155557632446289, 0.12367766350507736, -0.23189283907413483, 0.055988021194934845, 0.08753781020641327, 0.06897284090518951, 0.28997406363487244, 0.07451390475034714, 0.4161418676376343, 0.04203232750296593, -0.31354185938835144, -0.34835514426231384, 0.5198854207992554, -0.03438209369778633, -0.271411657333374, 0.30008918046951294, 0.5188669562339783, -0.34985294938087463, -0.10039042681455612, 0.12252308428287506, 0.45780670642852783, -0.25626036524772644, 0.15132583677768707, 0.08422946184873581, -0.16238678991794586, 0.0760197639465332, -0.15231524407863617, 0.3884741961956024, -0.3539924621582031, -0.38853025436401367, 0.0028728952165693045, 0.0030920403078198433, -0.07987355440855026, 0.37980255484580994, -0.20288437604904175, 0.19962027668952942, 0.030966708436608315, 0.1436246931552887, -0.21247147023677826, 0.1080198884010315, 0.02416945993900299, 0.06602545082569122, -0.413293719291687, 0.258748859167099, -0.014453104697167873, -0.22002233564853668, -0.1026776134967804, 0.15408167243003845, 0.3859541416168213, -0.34680116176605225, 0.020468860864639282, -0.1017046645283699, -0.21351243555545807, 0.2738752067089081, -0.28672537207603455, -0.05902617797255516, 0.0654316172003746, 0.3275730609893799, 0.25089380145072937, 0.2156902253627777, 0.18395817279815674, 0.17460931837558746, 0.09350919723510742, 0.4132477939128876, -0.03079063817858696, -0.12332703173160553, 0.0029667324852198362, -0.09036454558372498, -0.05656089633703232, -0.30132967233657837, 0.3779541850090027, -0.4599745571613312, -0.10072620958089828, 0.23339299857616425, -0.1467258632183075, 0.005664231721311808, 0.033732131123542786, 0.24836429953575134, 0.10704982280731201, -0.2621464729309082, 0.27916207909584045, 0.017606908455491066, 0.021781371906399727, 0.3856351673603058, -0.2298927903175354, 0.1456385850906372, 0.08664967119693756, 0.42799511551856995, 0.19120997190475464, 0.08677171170711517, 0.22853656113147736, 0.13159969449043274, -0.46108412742614746, -0.3208995759487152, -0.10690692067146301, 0.10199175029993057, 0.1377643495798111, 0.2878592908382416, -0.17465543746948242, -0.026994826272130013, 0.12229665368795395, 0.1870105117559433, -0.14917251467704773, -0.029341941699385643, 0.02487516589462757, -0.13401098549365997, 0.06822408735752106, 0.047108255326747894, 0.30334365367889404, 0.22584572434425354, 0.015977801755070686, 0.044641077518463135, -0.0853179469704628, -0.01034301333129406, -0.41374990344047546, 0.011657039634883404, 0.024023350328207016, 0.21102935075759888, 0.11200687289237976, 0.07604470103979111, -0.13820010423660278, -0.033245693892240524, 0.29385697841644287, -0.2629936933517456, -0.1742492914199829, -0.4430278539657593, 0.059456586837768555, -0.005820879712700844, -0.08289095759391785, 0.230892613530159, 0.021758709102869034, -0.34936586022377014, -0.21420831978321075, -0.1783481240272522, 0.2030445635318756, 0.2989426851272583, -0.0071336147375404835, 0.35147884488105774, 0.2581545114517212, -0.0035942327231168747, 0.23585103452205658, 0.19561876356601715, 0.06273454427719116, -0.45853444933891296, 0.15426231920719147, 0.44000306725502014, -0.0585353821516037, 0.07727967947721481, -0.07029365748167038, 0.0784812718629837, 0.2070714235305786, 0.06912847608327866, 0.06716207414865494, -0.38276374340057373, -0.2325223684310913, 0.35732418298721313, 0.5423648953437805, 0.40724581480026245, 0.009469843469560146, -0.11992395669221878, -0.18630734086036682, 0.2812197804450989, -0.423431932926178, -0.3921651542186737, 0.22317716479301453, 0.2112451046705246, 0.04564488306641579, -0.11524758487939835, -0.26262569427490234, 0.11134424805641174, 0.03918910026550293, 0.10051245242357254, -0.06835640221834183, -0.15422244369983673, 0.3816716969013214, 0.34196603298187256, 0.11520474404096603, -0.248460054397583, 0.09961001574993134, -0.0036607254296541214, -0.19121837615966797, 0.5780709981918335, 0.013111012056469917, 0.31486907601356506, 0.0862170159816742, -0.22058995068073273, -0.013476642780005932, -0.2652890086174011, 0.29852157831192017, 0.11329348385334015, 0.049394916743040085, -0.09555695205926895, 0.4409901201725006, -0.03224068507552147, 0.003891852218657732, -0.23988521099090576, -0.3835207223892212, 0.03165460377931595, -0.10211504995822906, -0.19804491102695465, -0.06268967688083649, -0.17793291807174683, 0.08181717991828918, -0.004636696074157953, -0.10522919148206711, -0.04847212880849838, 0.14905807375907898, -0.06979266554117203, 0.2193257361650467, -0.7102015614509583, 0.35685229301452637, -0.015394576825201511, 0.21962790191173553, -0.006895689759403467, 0.027445456013083458, 0.19851267337799072, 0.13520324230194092, 0.07749417424201965, -0.1274237483739853, 0.06324156373739243, -0.08694829046726227, 0.017552901059389114, -0.01817288063466549, -0.04402824118733406, -0.1820732206106186, -0.06733627617359161, -0.2454107105731964, -0.29899415373802185, 0.19106021523475647, 0.4642946422100067, 0.257941335439682, -0.21172159910202026, 0.21024756133556366, 0.1895163655281067, -0.0018318326910957694, -0.04670119285583496, 0.007600108161568642, -0.3009836971759796, -0.3384607136249542, 0.06299804151058197, 0.11697909981012344, -0.027359738945961, -0.39263486862182617, 0.037846047431230545, 0.008233655244112015, -0.0022859221789985895, -0.46609991788864136, 0.190652534365654, 0.036641042679548264, 0.3921414613723755, 0.13660885393619537, 0.08760827034711838, -0.19138385355472565, -0.12887336313724518, -0.6261276006698608, -0.07745063304901123, 0.1408565193414688, -0.027239365503191948, -0.06064930185675621, 0.23845764994621277, 0.05874178186058998, -0.2467811405658722, 0.28996142745018005, -0.4334382116794586, 0.026411909610033035, 0.02390831522643566, -0.3930666744709015, -0.05343015119433403, -0.013798928819596767, -0.03626582399010658, -0.08431702852249146, -0.3480244576931, -0.14173582196235657, -0.10429704934358597, 0.27614304423332214, -0.3093971610069275, 0.3391559422016144, -0.1596834361553192, -0.21434177458286285, -0.12942498922348022, 0.02752583660185337, 0.48605242371559143, 0.04348034784197807, 0.09970365464687347, 0.1253850907087326, 0.02560342475771904, -0.3106209337711334, 0.10070642083883286, 0.15451855957508087, 0.2941522002220154, -0.11882753670215607, -0.010397731326520443, 0.1382458209991455, -0.06621773540973663, 0.1894260197877884, 0.14562833309173584, -0.09207150340080261, 0.15960288047790527, -0.03433007001876831, -0.05577749386429787, -0.18556027114391327, -0.007284427527338266, 0.006871192716062069, 0.1802998036146164, 0.20399022102355957, -0.2509247660636902, 0.0992012694478035, -0.23715899884700775, -0.24451328814029694, -0.12316786497831345, 0.08535350114107132, 0.24743087589740753, -0.19652345776557922, 0.16342605650424957, -0.006512903142720461, 0.3367505967617035, 0.14198456704616547, -0.07453657686710358, 0.3665940761566162, -0.2272612750530243, -0.041563794016838074, -0.10113099962472916, -0.04538671299815178, 0.08844989538192749, -0.4045807421207428, -0.05784080550074577, -0.21537308394908905 ]
https://github.com/huggingface/datasets/issues/5425
Sort on multiple keys with datasets.Dataset.sort()
@MichlF No, it doesn't require modifying select because sorting on multiple keys also returns a 1D array. It's easier to understand with an example: ```python >>> import pyarrow as pa >>> import pyarrow.compute as pc >>> table = pa.table({ ... "name": ["John", "Eve", "Peter", "John"], ... "surname": ["Johnson", "Smith", "Smith", "Doe"], ... "age": [20, 40, 30, 50], ... }) >>> indices = pc.sort_indices(table, sort_keys=[("name", "ascending"), ("surname", "ascending")]) >>> print(indices) [ 1, 3, 0, 2 ] ```
### Feature request From discussion on forum: https://discuss.huggingface.co/t/datasets-dataset-sort-does-not-preserve-ordering/29065/1 `sort()` does not preserve ordering, and it does not support sorting on multiple columns, nor a key function. The suggested solution: > ... having something similar to pandas and be able to specify multiple columns for sorting. We’re already using pandas under the hood to do the sorting in datasets. The suggested workaround: > convert your dataset to pandas and use `df.sort_values()` ### Motivation Preserved ordering when sorting is very handy when one needs to sort on multiple columns, A and B, so that e.g. whenever A is equal for two or more rows, B is kept sorted. Having a parameter to do this in 🤗datasets would be cleaner than going through pandas and back, and it wouldn't add much complexity to the library. Alternatives: - the possibility to specify multiple keys to sort by with decreasing priority (suggested solution), - the ability to provide a key function for sorting, so that one can manually specify the sorting criteria. ### Your contribution I'll be happy to contribute by submitting a PR. Will get documented on `CONTRIBUTING.MD`. Would love to get thoughts on this, if anyone has anything to add.
76
Sort on multiple keys with datasets.Dataset.sort()
[ 0.028741464018821716, -0.09899337589740753, -0.2973214089870453, 0.11221349984407425, 0.1764691323041916, 0.08357195556163788, 0.06119823083281517, 0.2558813989162445, -0.13195225596427917, 0.04995827376842499, -0.10002277791500092, 0.22852276265621185, 0.005976022221148014, 0.11916109919548035, 0.1299404352903366, -0.1751485913991928, -0.052675873041152954, 0.07647618651390076, 0.10694260150194168, -0.037278253585100174, -0.10407478362321854, -0.018843917176127434, -0.36189672350883484, 0.022627171128988266, 0.16309456527233124, -0.211319699883461, -0.13150985538959503, 0.06319349259138107, -0.20336928963661194, -0.39403992891311646, -0.023737367242574692, 0.3600752353668213, -0.2311311960220337, 0.2830202877521515, -0.00009829093323787674, -0.027034558355808258, -0.15511251986026764, -0.06828892976045609, -0.14293275773525238, -0.05293061584234238, -0.13685062527656555, 0.1365538090467453, -0.31148025393486023, -0.16597580909729004, -0.26916879415512085, -0.517481803894043, 0.07312311977148056, -0.3936796188354492, 0.21545954048633575, 0.11239194869995117, 0.30136850476264954, 0.21242313086986542, 0.08837921172380447, -0.020500464364886284, 0.15879520773887634, -0.038167804479599, 0.03924916312098503, -0.27118930220603943, 0.14484061300754547, 0.15542326867580414, -0.042367320507764816, 0.17660818994045258, -0.06745560467243195, -0.20266829431056976, 0.27615466713905334, -0.04900844767689705, -0.1744646579027176, 0.07352420687675476, 0.276804655790329, -0.048764731734991074, 0.42820027470588684, -0.3786011040210724, -0.3875385820865631, -0.18187670409679413, 0.1576341986656189, 0.041407711803913116, 0.01363010611385107, -0.11205583065748215, 0.1906524896621704, -0.18286876380443573, 0.0253467820584774, -0.04230644553899765, -0.10334239900112152, 0.33909863233566284, -0.21739134192466736, 0.25068655610084534, -0.14904356002807617, -0.05559879541397095, 0.2212914377450943, -0.31704574823379517, 0.11758691817522049, -0.48928478360176086, 0.07492232322692871, 0.12360358983278275, -0.3871307075023651, -0.23457695543766022, 0.41621190309524536, 0.3631003499031067, 0.20420928299427032, -0.23175935447216034, -0.09831859171390533, 0.03442925214767456, 0.11145657300949097, -0.07862799614667892, 0.4601077437400818, 0.23155617713928223, 0.4143107533454895, 0.2871588170528412, 0.10558782517910004, -0.15301452577114105, -0.08470325917005539, 0.008258804678916931, 0.23843777179718018, -0.4598367214202881, -0.11582072824239731, 0.2984207272529602, -0.0024685747921466827, -0.01222578901797533, -0.07282502204179764, -0.13710127770900726, 0.2499946653842926, -0.11843417584896088, 0.32767945528030396, 0.4415939152240753, 0.15942507982254028, 0.015413908287882805, -0.30153194069862366, 0.05728483200073242, 0.04334966465830803, 0.2917996346950531, -0.3173701763153076, -0.016046281903982162, 0.11875352263450623, -0.18779811263084412, 0.06037387251853943, -0.09712766855955124, -0.16569070518016815, 0.122409388422966, 0.1567566990852356, -0.10008503496646881, 0.08057725429534912, 0.06857022643089294, 0.2257465422153473, 0.29695039987564087, 0.11611581593751907, 0.1641055941581726, -0.025623725727200508, -0.12034722417593002, -0.25645431876182556, 0.205649733543396, -0.3393760025501251, -0.20160476863384247, 0.2391362488269806, 0.2643216848373413, 0.12448668479919434, 0.09156861156225204, -0.2836962938308716, 0.10045425593852997, 0.2931644320487976, -0.2490716278553009, -0.1282299906015396, 0.10369186848402023, -0.1263352930545807, -0.1338959038257599, -0.07697287946939468, -0.01695343852043152, -0.23882731795310974, 0.013437679037451744, -0.2867739200592041, 0.0458216592669487, -0.14717240631580353, -0.022884326055645943, -0.1372058242559433, 0.1682179868221283, 0.08400566130876541, 0.4115127623081207, 0.5246119499206543, -0.25035303831100464, -0.5486193299293518, 0.24931985139846802, -0.12953656911849976, -0.316114604473114, 0.16261045634746552, 0.36588165163993835, 0.21764063835144043, -0.1080687940120697, 0.17386585474014282, 0.09656177461147308, 0.06566561013460159, 0.1413278877735138, 0.05509106442332268, 0.026691755279898643, 0.04763496667146683, 0.09746909886598587, 0.18258927762508392, -0.18801520764827728, 0.18442866206169128, -0.12867653369903564, 0.07147156447172165, -0.17986805737018585, -0.2552776038646698, 0.2932296693325043, -0.07146204262971878, -0.04671154171228409, 0.11469095200300217, -0.1888485997915268, -0.2776067554950714, 0.09598945081233978, 0.21691830456256866, -0.19637557864189148, -0.3188058137893677, -0.1703096330165863, -0.15814805030822754, 0.003167852759361267, -0.2981880307197571, 0.43992531299591064, 0.30934813618659973, 0.04590253904461861, -0.14083395898342133, -0.09301429986953735, -0.10139147192239761, 0.07767325639724731, 0.14301806688308716, -0.13094200193881989, -0.18788938224315643, 0.30042821168899536, -0.25594988465309143, 0.31301772594451904, 0.10518334805965424, -0.07078729569911957, 0.2558874189853668, 0.10056102275848389, 0.12523286044597626, 0.3052782714366913, 0.046064846217632294, -0.17728833854198456, 0.13048811256885529, 0.07967263460159302, -0.02715574949979782, 0.14838431775569916, 0.08697950839996338, 0.1438976377248764, -0.011832283809781075, 0.06474629044532776, -0.5371254086494446, 0.6956678628921509, -0.2035532146692276, 0.19834968447685242, 0.15104900300502777, -0.05159931257367134, -0.04776904359459877, 0.26706406474113464, 0.022406242787837982, -0.23311270773410797, 0.18953894078731537, 0.21901406347751617, -0.024510568007826805, 0.10708460211753845, -0.11982258409261703, 0.41455453634262085, 0.6199867129325867, 0.03352299705147743, 0.27068352699279785, -0.12812234461307526, 0.12096802890300751, 0.12044632434844971, 0.09573175758123398, 0.32039573788642883, -0.00476019037887454, 0.36533504724502563, 0.12256555259227753, -0.2140568345785141, -0.004775006789714098, -0.010725472122430801, -0.040854353457689285, 0.03006882406771183, -0.28911444544792175, 0.3847918212413788, 0.22437109053134918, 0.023196067661046982, -0.4351916015148163, 0.019098928198218346, 0.2587398886680603, -0.002195655135437846, -0.25597551465034485, -0.06115487217903137, -0.23312318325042725, -0.23552662134170532, 0.2014453411102295, -0.028508152812719345, -0.2556595206260681, -0.20508043467998505, 0.2772729992866516, -0.18023738265037537, -0.020554974675178528, 0.058181796222925186, 0.06811882555484772, 0.11395329982042313, 0.29818376898765564, -0.04306061565876007, 0.06895627826452255, -0.1549319475889206, 0.0038211180362850428, 0.1969866007566452, 0.19441509246826172, 0.18841761350631714, 0.4552612602710724, -0.023151539266109467, -0.10380826890468597, -0.0008603439200669527, -0.3883145749568939, -0.16494590044021606, -0.16007906198501587, -0.04555778577923775, 0.10475696623325348, 0.07942239940166473, -0.170744851231575, -0.014722604304552078, 0.07637723535299301, 0.239674910902977, -0.2990134060382843, 0.18565014004707336, 0.07611586898565292, -0.24249188601970673, -0.22554217278957367, -0.31050577759742737, 0.1628037840127945, 0.04459526762366295, 0.02515130117535591, -0.009111699648201466, 0.32996299862861633, -0.2689761519432068, -0.06573230773210526, -0.08190502971410751, -0.09226939082145691, -0.015839165076613426, -0.11080092936754227, 0.0911756157875061, 0.26182058453559875, -0.017259590327739716, -0.11627946048974991, -0.17516663670539856, 0.018687555566430092, -0.37253737449645996, 0.096438929438591, -0.08320402354001999, -0.2570739686489105, -0.11962383985519409, 0.2844480574131012, -0.023050813004374504, 0.31526288390159607, 0.3632940351963043, 0.17984257638454437, -0.15952637791633606, -0.2913755476474762, -0.212080717086792, -0.12867677211761475, 0.03576914593577385, 0.06076393648982048, -0.222672238945961, 0.37091925740242004, 0.4100162088871002, 0.314433217048645, -0.31595489382743835, 0.05251911282539368, 0.09986817091703415, 0.0971875935792923, 0.1581433266401291, -0.026691561564803123, -0.3397607207298279, 0.07663605362176895, 0.26961347460746765, 0.2836642265319824, 0.21160617470741272, 0.1588263064622879, -0.004899116232991219, 0.05002809688448906, 0.023800497874617577, -0.16895371675491333, -0.03600868210196495, -0.10271711647510529, -0.09049990773200989, 0.0025359669234603643, 0.17975661158561707, 0.1987525075674057, -0.4322522282600403, -0.01353919692337513, -0.1523052304983139, -0.09588416665792465, -0.2775111496448517, -0.1532660275697708, -0.4073219299316406, -0.0225144661962986, -0.32482507824897766, 0.05860809236764908, 0.24598075449466705, -0.06660757958889008, 0.12772241234779358, 0.20894786715507507, -0.07537244260311127, -0.4535475969314575, 0.7264634966850281, -0.03479468449950218, 0.2244250476360321, 0.1056964322924614, -0.04653359577059746, -0.2877999544143677, 0.386326402425766, -0.0923352986574173, 0.3816564679145813, -0.3733280599117279, 0.4020630717277527, -0.3640495836734772, -0.11360924690961838, -0.2745121121406555, 0.06633970886468887, -0.0886177271604538, -0.3054408133029938, -0.23281055688858032, -0.1869032084941864, -0.056929413229227066, 0.1902729868888855, 0.04687241092324257, 0.0898398756980896, -0.20126931369304657, -0.1646491438150406, -0.11180843412876129, -0.14261658489704132, -0.042835865169763565, -0.043210916221141815, 0.32821163535118103, 0.306610643863678, -0.0194955226033926, 0.17154859006404877, 0.09807342290878296, 0.05853812396526337, 0.06522303074598312, 0.11859067529439926, -0.12706686556339264, -0.23855140805244446, -0.057969171553850174, -0.1155557632446289, 0.12367766350507736, -0.23189283907413483, 0.055988021194934845, 0.08753781020641327, 0.06897284090518951, 0.28997406363487244, 0.07451390475034714, 0.4161418676376343, 0.04203232750296593, -0.31354185938835144, -0.34835514426231384, 0.5198854207992554, -0.03438209369778633, -0.271411657333374, 0.30008918046951294, 0.5188669562339783, -0.34985294938087463, -0.10039042681455612, 0.12252308428287506, 0.45780670642852783, -0.25626036524772644, 0.15132583677768707, 0.08422946184873581, -0.16238678991794586, 0.0760197639465332, -0.15231524407863617, 0.3884741961956024, -0.3539924621582031, -0.38853025436401367, 0.0028728952165693045, 0.0030920403078198433, -0.07987355440855026, 0.37980255484580994, -0.20288437604904175, 0.19962027668952942, 0.030966708436608315, 0.1436246931552887, -0.21247147023677826, 0.1080198884010315, 0.02416945993900299, 0.06602545082569122, -0.413293719291687, 0.258748859167099, -0.014453104697167873, -0.22002233564853668, -0.1026776134967804, 0.15408167243003845, 0.3859541416168213, -0.34680116176605225, 0.020468860864639282, -0.1017046645283699, -0.21351243555545807, 0.2738752067089081, -0.28672537207603455, -0.05902617797255516, 0.0654316172003746, 0.3275730609893799, 0.25089380145072937, 0.2156902253627777, 0.18395817279815674, 0.17460931837558746, 0.09350919723510742, 0.4132477939128876, -0.03079063817858696, -0.12332703173160553, 0.0029667324852198362, -0.09036454558372498, -0.05656089633703232, -0.30132967233657837, 0.3779541850090027, -0.4599745571613312, -0.10072620958089828, 0.23339299857616425, -0.1467258632183075, 0.005664231721311808, 0.033732131123542786, 0.24836429953575134, 0.10704982280731201, -0.2621464729309082, 0.27916207909584045, 0.017606908455491066, 0.021781371906399727, 0.3856351673603058, -0.2298927903175354, 0.1456385850906372, 0.08664967119693756, 0.42799511551856995, 0.19120997190475464, 0.08677171170711517, 0.22853656113147736, 0.13159969449043274, -0.46108412742614746, -0.3208995759487152, -0.10690692067146301, 0.10199175029993057, 0.1377643495798111, 0.2878592908382416, -0.17465543746948242, -0.026994826272130013, 0.12229665368795395, 0.1870105117559433, -0.14917251467704773, -0.029341941699385643, 0.02487516589462757, -0.13401098549365997, 0.06822408735752106, 0.047108255326747894, 0.30334365367889404, 0.22584572434425354, 0.015977801755070686, 0.044641077518463135, -0.0853179469704628, -0.01034301333129406, -0.41374990344047546, 0.011657039634883404, 0.024023350328207016, 0.21102935075759888, 0.11200687289237976, 0.07604470103979111, -0.13820010423660278, -0.033245693892240524, 0.29385697841644287, -0.2629936933517456, -0.1742492914199829, -0.4430278539657593, 0.059456586837768555, -0.005820879712700844, -0.08289095759391785, 0.230892613530159, 0.021758709102869034, -0.34936586022377014, -0.21420831978321075, -0.1783481240272522, 0.2030445635318756, 0.2989426851272583, -0.0071336147375404835, 0.35147884488105774, 0.2581545114517212, -0.0035942327231168747, 0.23585103452205658, 0.19561876356601715, 0.06273454427719116, -0.45853444933891296, 0.15426231920719147, 0.44000306725502014, -0.0585353821516037, 0.07727967947721481, -0.07029365748167038, 0.0784812718629837, 0.2070714235305786, 0.06912847608327866, 0.06716207414865494, -0.38276374340057373, -0.2325223684310913, 0.35732418298721313, 0.5423648953437805, 0.40724581480026245, 0.009469843469560146, -0.11992395669221878, -0.18630734086036682, 0.2812197804450989, -0.423431932926178, -0.3921651542186737, 0.22317716479301453, 0.2112451046705246, 0.04564488306641579, -0.11524758487939835, -0.26262569427490234, 0.11134424805641174, 0.03918910026550293, 0.10051245242357254, -0.06835640221834183, -0.15422244369983673, 0.3816716969013214, 0.34196603298187256, 0.11520474404096603, -0.248460054397583, 0.09961001574993134, -0.0036607254296541214, -0.19121837615966797, 0.5780709981918335, 0.013111012056469917, 0.31486907601356506, 0.0862170159816742, -0.22058995068073273, -0.013476642780005932, -0.2652890086174011, 0.29852157831192017, 0.11329348385334015, 0.049394916743040085, -0.09555695205926895, 0.4409901201725006, -0.03224068507552147, 0.003891852218657732, -0.23988521099090576, -0.3835207223892212, 0.03165460377931595, -0.10211504995822906, -0.19804491102695465, -0.06268967688083649, -0.17793291807174683, 0.08181717991828918, -0.004636696074157953, -0.10522919148206711, -0.04847212880849838, 0.14905807375907898, -0.06979266554117203, 0.2193257361650467, -0.7102015614509583, 0.35685229301452637, -0.015394576825201511, 0.21962790191173553, -0.006895689759403467, 0.027445456013083458, 0.19851267337799072, 0.13520324230194092, 0.07749417424201965, -0.1274237483739853, 0.06324156373739243, -0.08694829046726227, 0.017552901059389114, -0.01817288063466549, -0.04402824118733406, -0.1820732206106186, -0.06733627617359161, -0.2454107105731964, -0.29899415373802185, 0.19106021523475647, 0.4642946422100067, 0.257941335439682, -0.21172159910202026, 0.21024756133556366, 0.1895163655281067, -0.0018318326910957694, -0.04670119285583496, 0.007600108161568642, -0.3009836971759796, -0.3384607136249542, 0.06299804151058197, 0.11697909981012344, -0.027359738945961, -0.39263486862182617, 0.037846047431230545, 0.008233655244112015, -0.0022859221789985895, -0.46609991788864136, 0.190652534365654, 0.036641042679548264, 0.3921414613723755, 0.13660885393619537, 0.08760827034711838, -0.19138385355472565, -0.12887336313724518, -0.6261276006698608, -0.07745063304901123, 0.1408565193414688, -0.027239365503191948, -0.06064930185675621, 0.23845764994621277, 0.05874178186058998, -0.2467811405658722, 0.28996142745018005, -0.4334382116794586, 0.026411909610033035, 0.02390831522643566, -0.3930666744709015, -0.05343015119433403, -0.013798928819596767, -0.03626582399010658, -0.08431702852249146, -0.3480244576931, -0.14173582196235657, -0.10429704934358597, 0.27614304423332214, -0.3093971610069275, 0.3391559422016144, -0.1596834361553192, -0.21434177458286285, -0.12942498922348022, 0.02752583660185337, 0.48605242371559143, 0.04348034784197807, 0.09970365464687347, 0.1253850907087326, 0.02560342475771904, -0.3106209337711334, 0.10070642083883286, 0.15451855957508087, 0.2941522002220154, -0.11882753670215607, -0.010397731326520443, 0.1382458209991455, -0.06621773540973663, 0.1894260197877884, 0.14562833309173584, -0.09207150340080261, 0.15960288047790527, -0.03433007001876831, -0.05577749386429787, -0.18556027114391327, -0.007284427527338266, 0.006871192716062069, 0.1802998036146164, 0.20399022102355957, -0.2509247660636902, 0.0992012694478035, -0.23715899884700775, -0.24451328814029694, -0.12316786497831345, 0.08535350114107132, 0.24743087589740753, -0.19652345776557922, 0.16342605650424957, -0.006512903142720461, 0.3367505967617035, 0.14198456704616547, -0.07453657686710358, 0.3665940761566162, -0.2272612750530243, -0.041563794016838074, -0.10113099962472916, -0.04538671299815178, 0.08844989538192749, -0.4045807421207428, -0.05784080550074577, -0.21537308394908905 ]
https://github.com/huggingface/datasets/issues/5425
Sort on multiple keys with datasets.Dataset.sort()
Thanks for clarifying. I can prepare a PR to address this issue. This would be my first PR here so I have a few maybe silly questions but: - What is the preferred input type of `sort_keys` for the sort method? A sequence with name, order tuples like pyarrow's `sort_indices` requires? - What about backwards compatability: is it supposed to also accept the old way of calling sort() or should both `column` and `kind` be deprecated? - If `sort_keys` is provided in the same format as for pyarrow's `sort_indices` - i.e. along with order for each column -, `reverse` doesn't make much sense either and should be deprecated as well I assume.
### Feature request From discussion on forum: https://discuss.huggingface.co/t/datasets-dataset-sort-does-not-preserve-ordering/29065/1 `sort()` does not preserve ordering, and it does not support sorting on multiple columns, nor a key function. The suggested solution: > ... having something similar to pandas and be able to specify multiple columns for sorting. We’re already using pandas under the hood to do the sorting in datasets. The suggested workaround: > convert your dataset to pandas and use `df.sort_values()` ### Motivation Preserved ordering when sorting is very handy when one needs to sort on multiple columns, A and B, so that e.g. whenever A is equal for two or more rows, B is kept sorted. Having a parameter to do this in 🤗datasets would be cleaner than going through pandas and back, and it wouldn't add much complexity to the library. Alternatives: - the possibility to specify multiple keys to sort by with decreasing priority (suggested solution), - the ability to provide a key function for sorting, so that one can manually specify the sorting criteria. ### Your contribution I'll be happy to contribute by submitting a PR. Will get documented on `CONTRIBUTING.MD`. Would love to get thoughts on this, if anyone has anything to add.
112
Sort on multiple keys with datasets.Dataset.sort()
[ 0.028741464018821716, -0.09899337589740753, -0.2973214089870453, 0.11221349984407425, 0.1764691323041916, 0.08357195556163788, 0.06119823083281517, 0.2558813989162445, -0.13195225596427917, 0.04995827376842499, -0.10002277791500092, 0.22852276265621185, 0.005976022221148014, 0.11916109919548035, 0.1299404352903366, -0.1751485913991928, -0.052675873041152954, 0.07647618651390076, 0.10694260150194168, -0.037278253585100174, -0.10407478362321854, -0.018843917176127434, -0.36189672350883484, 0.022627171128988266, 0.16309456527233124, -0.211319699883461, -0.13150985538959503, 0.06319349259138107, -0.20336928963661194, -0.39403992891311646, -0.023737367242574692, 0.3600752353668213, -0.2311311960220337, 0.2830202877521515, -0.00009829093323787674, -0.027034558355808258, -0.15511251986026764, -0.06828892976045609, -0.14293275773525238, -0.05293061584234238, -0.13685062527656555, 0.1365538090467453, -0.31148025393486023, -0.16597580909729004, -0.26916879415512085, -0.517481803894043, 0.07312311977148056, -0.3936796188354492, 0.21545954048633575, 0.11239194869995117, 0.30136850476264954, 0.21242313086986542, 0.08837921172380447, -0.020500464364886284, 0.15879520773887634, -0.038167804479599, 0.03924916312098503, -0.27118930220603943, 0.14484061300754547, 0.15542326867580414, -0.042367320507764816, 0.17660818994045258, -0.06745560467243195, -0.20266829431056976, 0.27615466713905334, -0.04900844767689705, -0.1744646579027176, 0.07352420687675476, 0.276804655790329, -0.048764731734991074, 0.42820027470588684, -0.3786011040210724, -0.3875385820865631, -0.18187670409679413, 0.1576341986656189, 0.041407711803913116, 0.01363010611385107, -0.11205583065748215, 0.1906524896621704, -0.18286876380443573, 0.0253467820584774, -0.04230644553899765, -0.10334239900112152, 0.33909863233566284, -0.21739134192466736, 0.25068655610084534, -0.14904356002807617, -0.05559879541397095, 0.2212914377450943, -0.31704574823379517, 0.11758691817522049, -0.48928478360176086, 0.07492232322692871, 0.12360358983278275, -0.3871307075023651, -0.23457695543766022, 0.41621190309524536, 0.3631003499031067, 0.20420928299427032, -0.23175935447216034, -0.09831859171390533, 0.03442925214767456, 0.11145657300949097, -0.07862799614667892, 0.4601077437400818, 0.23155617713928223, 0.4143107533454895, 0.2871588170528412, 0.10558782517910004, -0.15301452577114105, -0.08470325917005539, 0.008258804678916931, 0.23843777179718018, -0.4598367214202881, -0.11582072824239731, 0.2984207272529602, -0.0024685747921466827, -0.01222578901797533, -0.07282502204179764, -0.13710127770900726, 0.2499946653842926, -0.11843417584896088, 0.32767945528030396, 0.4415939152240753, 0.15942507982254028, 0.015413908287882805, -0.30153194069862366, 0.05728483200073242, 0.04334966465830803, 0.2917996346950531, -0.3173701763153076, -0.016046281903982162, 0.11875352263450623, -0.18779811263084412, 0.06037387251853943, -0.09712766855955124, -0.16569070518016815, 0.122409388422966, 0.1567566990852356, -0.10008503496646881, 0.08057725429534912, 0.06857022643089294, 0.2257465422153473, 0.29695039987564087, 0.11611581593751907, 0.1641055941581726, -0.025623725727200508, -0.12034722417593002, -0.25645431876182556, 0.205649733543396, -0.3393760025501251, -0.20160476863384247, 0.2391362488269806, 0.2643216848373413, 0.12448668479919434, 0.09156861156225204, -0.2836962938308716, 0.10045425593852997, 0.2931644320487976, -0.2490716278553009, -0.1282299906015396, 0.10369186848402023, -0.1263352930545807, -0.1338959038257599, -0.07697287946939468, -0.01695343852043152, -0.23882731795310974, 0.013437679037451744, -0.2867739200592041, 0.0458216592669487, -0.14717240631580353, -0.022884326055645943, -0.1372058242559433, 0.1682179868221283, 0.08400566130876541, 0.4115127623081207, 0.5246119499206543, -0.25035303831100464, -0.5486193299293518, 0.24931985139846802, -0.12953656911849976, -0.316114604473114, 0.16261045634746552, 0.36588165163993835, 0.21764063835144043, -0.1080687940120697, 0.17386585474014282, 0.09656177461147308, 0.06566561013460159, 0.1413278877735138, 0.05509106442332268, 0.026691755279898643, 0.04763496667146683, 0.09746909886598587, 0.18258927762508392, -0.18801520764827728, 0.18442866206169128, -0.12867653369903564, 0.07147156447172165, -0.17986805737018585, -0.2552776038646698, 0.2932296693325043, -0.07146204262971878, -0.04671154171228409, 0.11469095200300217, -0.1888485997915268, -0.2776067554950714, 0.09598945081233978, 0.21691830456256866, -0.19637557864189148, -0.3188058137893677, -0.1703096330165863, -0.15814805030822754, 0.003167852759361267, -0.2981880307197571, 0.43992531299591064, 0.30934813618659973, 0.04590253904461861, -0.14083395898342133, -0.09301429986953735, -0.10139147192239761, 0.07767325639724731, 0.14301806688308716, -0.13094200193881989, -0.18788938224315643, 0.30042821168899536, -0.25594988465309143, 0.31301772594451904, 0.10518334805965424, -0.07078729569911957, 0.2558874189853668, 0.10056102275848389, 0.12523286044597626, 0.3052782714366913, 0.046064846217632294, -0.17728833854198456, 0.13048811256885529, 0.07967263460159302, -0.02715574949979782, 0.14838431775569916, 0.08697950839996338, 0.1438976377248764, -0.011832283809781075, 0.06474629044532776, -0.5371254086494446, 0.6956678628921509, -0.2035532146692276, 0.19834968447685242, 0.15104900300502777, -0.05159931257367134, -0.04776904359459877, 0.26706406474113464, 0.022406242787837982, -0.23311270773410797, 0.18953894078731537, 0.21901406347751617, -0.024510568007826805, 0.10708460211753845, -0.11982258409261703, 0.41455453634262085, 0.6199867129325867, 0.03352299705147743, 0.27068352699279785, -0.12812234461307526, 0.12096802890300751, 0.12044632434844971, 0.09573175758123398, 0.32039573788642883, -0.00476019037887454, 0.36533504724502563, 0.12256555259227753, -0.2140568345785141, -0.004775006789714098, -0.010725472122430801, -0.040854353457689285, 0.03006882406771183, -0.28911444544792175, 0.3847918212413788, 0.22437109053134918, 0.023196067661046982, -0.4351916015148163, 0.019098928198218346, 0.2587398886680603, -0.002195655135437846, -0.25597551465034485, -0.06115487217903137, -0.23312318325042725, -0.23552662134170532, 0.2014453411102295, -0.028508152812719345, -0.2556595206260681, -0.20508043467998505, 0.2772729992866516, -0.18023738265037537, -0.020554974675178528, 0.058181796222925186, 0.06811882555484772, 0.11395329982042313, 0.29818376898765564, -0.04306061565876007, 0.06895627826452255, -0.1549319475889206, 0.0038211180362850428, 0.1969866007566452, 0.19441509246826172, 0.18841761350631714, 0.4552612602710724, -0.023151539266109467, -0.10380826890468597, -0.0008603439200669527, -0.3883145749568939, -0.16494590044021606, -0.16007906198501587, -0.04555778577923775, 0.10475696623325348, 0.07942239940166473, -0.170744851231575, -0.014722604304552078, 0.07637723535299301, 0.239674910902977, -0.2990134060382843, 0.18565014004707336, 0.07611586898565292, -0.24249188601970673, -0.22554217278957367, -0.31050577759742737, 0.1628037840127945, 0.04459526762366295, 0.02515130117535591, -0.009111699648201466, 0.32996299862861633, -0.2689761519432068, -0.06573230773210526, -0.08190502971410751, -0.09226939082145691, -0.015839165076613426, -0.11080092936754227, 0.0911756157875061, 0.26182058453559875, -0.017259590327739716, -0.11627946048974991, -0.17516663670539856, 0.018687555566430092, -0.37253737449645996, 0.096438929438591, -0.08320402354001999, -0.2570739686489105, -0.11962383985519409, 0.2844480574131012, -0.023050813004374504, 0.31526288390159607, 0.3632940351963043, 0.17984257638454437, -0.15952637791633606, -0.2913755476474762, -0.212080717086792, -0.12867677211761475, 0.03576914593577385, 0.06076393648982048, -0.222672238945961, 0.37091925740242004, 0.4100162088871002, 0.314433217048645, -0.31595489382743835, 0.05251911282539368, 0.09986817091703415, 0.0971875935792923, 0.1581433266401291, -0.026691561564803123, -0.3397607207298279, 0.07663605362176895, 0.26961347460746765, 0.2836642265319824, 0.21160617470741272, 0.1588263064622879, -0.004899116232991219, 0.05002809688448906, 0.023800497874617577, -0.16895371675491333, -0.03600868210196495, -0.10271711647510529, -0.09049990773200989, 0.0025359669234603643, 0.17975661158561707, 0.1987525075674057, -0.4322522282600403, -0.01353919692337513, -0.1523052304983139, -0.09588416665792465, -0.2775111496448517, -0.1532660275697708, -0.4073219299316406, -0.0225144661962986, -0.32482507824897766, 0.05860809236764908, 0.24598075449466705, -0.06660757958889008, 0.12772241234779358, 0.20894786715507507, -0.07537244260311127, -0.4535475969314575, 0.7264634966850281, -0.03479468449950218, 0.2244250476360321, 0.1056964322924614, -0.04653359577059746, -0.2877999544143677, 0.386326402425766, -0.0923352986574173, 0.3816564679145813, -0.3733280599117279, 0.4020630717277527, -0.3640495836734772, -0.11360924690961838, -0.2745121121406555, 0.06633970886468887, -0.0886177271604538, -0.3054408133029938, -0.23281055688858032, -0.1869032084941864, -0.056929413229227066, 0.1902729868888855, 0.04687241092324257, 0.0898398756980896, -0.20126931369304657, -0.1646491438150406, -0.11180843412876129, -0.14261658489704132, -0.042835865169763565, -0.043210916221141815, 0.32821163535118103, 0.306610643863678, -0.0194955226033926, 0.17154859006404877, 0.09807342290878296, 0.05853812396526337, 0.06522303074598312, 0.11859067529439926, -0.12706686556339264, -0.23855140805244446, -0.057969171553850174, -0.1155557632446289, 0.12367766350507736, -0.23189283907413483, 0.055988021194934845, 0.08753781020641327, 0.06897284090518951, 0.28997406363487244, 0.07451390475034714, 0.4161418676376343, 0.04203232750296593, -0.31354185938835144, -0.34835514426231384, 0.5198854207992554, -0.03438209369778633, -0.271411657333374, 0.30008918046951294, 0.5188669562339783, -0.34985294938087463, -0.10039042681455612, 0.12252308428287506, 0.45780670642852783, -0.25626036524772644, 0.15132583677768707, 0.08422946184873581, -0.16238678991794586, 0.0760197639465332, -0.15231524407863617, 0.3884741961956024, -0.3539924621582031, -0.38853025436401367, 0.0028728952165693045, 0.0030920403078198433, -0.07987355440855026, 0.37980255484580994, -0.20288437604904175, 0.19962027668952942, 0.030966708436608315, 0.1436246931552887, -0.21247147023677826, 0.1080198884010315, 0.02416945993900299, 0.06602545082569122, -0.413293719291687, 0.258748859167099, -0.014453104697167873, -0.22002233564853668, -0.1026776134967804, 0.15408167243003845, 0.3859541416168213, -0.34680116176605225, 0.020468860864639282, -0.1017046645283699, -0.21351243555545807, 0.2738752067089081, -0.28672537207603455, -0.05902617797255516, 0.0654316172003746, 0.3275730609893799, 0.25089380145072937, 0.2156902253627777, 0.18395817279815674, 0.17460931837558746, 0.09350919723510742, 0.4132477939128876, -0.03079063817858696, -0.12332703173160553, 0.0029667324852198362, -0.09036454558372498, -0.05656089633703232, -0.30132967233657837, 0.3779541850090027, -0.4599745571613312, -0.10072620958089828, 0.23339299857616425, -0.1467258632183075, 0.005664231721311808, 0.033732131123542786, 0.24836429953575134, 0.10704982280731201, -0.2621464729309082, 0.27916207909584045, 0.017606908455491066, 0.021781371906399727, 0.3856351673603058, -0.2298927903175354, 0.1456385850906372, 0.08664967119693756, 0.42799511551856995, 0.19120997190475464, 0.08677171170711517, 0.22853656113147736, 0.13159969449043274, -0.46108412742614746, -0.3208995759487152, -0.10690692067146301, 0.10199175029993057, 0.1377643495798111, 0.2878592908382416, -0.17465543746948242, -0.026994826272130013, 0.12229665368795395, 0.1870105117559433, -0.14917251467704773, -0.029341941699385643, 0.02487516589462757, -0.13401098549365997, 0.06822408735752106, 0.047108255326747894, 0.30334365367889404, 0.22584572434425354, 0.015977801755070686, 0.044641077518463135, -0.0853179469704628, -0.01034301333129406, -0.41374990344047546, 0.011657039634883404, 0.024023350328207016, 0.21102935075759888, 0.11200687289237976, 0.07604470103979111, -0.13820010423660278, -0.033245693892240524, 0.29385697841644287, -0.2629936933517456, -0.1742492914199829, -0.4430278539657593, 0.059456586837768555, -0.005820879712700844, -0.08289095759391785, 0.230892613530159, 0.021758709102869034, -0.34936586022377014, -0.21420831978321075, -0.1783481240272522, 0.2030445635318756, 0.2989426851272583, -0.0071336147375404835, 0.35147884488105774, 0.2581545114517212, -0.0035942327231168747, 0.23585103452205658, 0.19561876356601715, 0.06273454427719116, -0.45853444933891296, 0.15426231920719147, 0.44000306725502014, -0.0585353821516037, 0.07727967947721481, -0.07029365748167038, 0.0784812718629837, 0.2070714235305786, 0.06912847608327866, 0.06716207414865494, -0.38276374340057373, -0.2325223684310913, 0.35732418298721313, 0.5423648953437805, 0.40724581480026245, 0.009469843469560146, -0.11992395669221878, -0.18630734086036682, 0.2812197804450989, -0.423431932926178, -0.3921651542186737, 0.22317716479301453, 0.2112451046705246, 0.04564488306641579, -0.11524758487939835, -0.26262569427490234, 0.11134424805641174, 0.03918910026550293, 0.10051245242357254, -0.06835640221834183, -0.15422244369983673, 0.3816716969013214, 0.34196603298187256, 0.11520474404096603, -0.248460054397583, 0.09961001574993134, -0.0036607254296541214, -0.19121837615966797, 0.5780709981918335, 0.013111012056469917, 0.31486907601356506, 0.0862170159816742, -0.22058995068073273, -0.013476642780005932, -0.2652890086174011, 0.29852157831192017, 0.11329348385334015, 0.049394916743040085, -0.09555695205926895, 0.4409901201725006, -0.03224068507552147, 0.003891852218657732, -0.23988521099090576, -0.3835207223892212, 0.03165460377931595, -0.10211504995822906, -0.19804491102695465, -0.06268967688083649, -0.17793291807174683, 0.08181717991828918, -0.004636696074157953, -0.10522919148206711, -0.04847212880849838, 0.14905807375907898, -0.06979266554117203, 0.2193257361650467, -0.7102015614509583, 0.35685229301452637, -0.015394576825201511, 0.21962790191173553, -0.006895689759403467, 0.027445456013083458, 0.19851267337799072, 0.13520324230194092, 0.07749417424201965, -0.1274237483739853, 0.06324156373739243, -0.08694829046726227, 0.017552901059389114, -0.01817288063466549, -0.04402824118733406, -0.1820732206106186, -0.06733627617359161, -0.2454107105731964, -0.29899415373802185, 0.19106021523475647, 0.4642946422100067, 0.257941335439682, -0.21172159910202026, 0.21024756133556366, 0.1895163655281067, -0.0018318326910957694, -0.04670119285583496, 0.007600108161568642, -0.3009836971759796, -0.3384607136249542, 0.06299804151058197, 0.11697909981012344, -0.027359738945961, -0.39263486862182617, 0.037846047431230545, 0.008233655244112015, -0.0022859221789985895, -0.46609991788864136, 0.190652534365654, 0.036641042679548264, 0.3921414613723755, 0.13660885393619537, 0.08760827034711838, -0.19138385355472565, -0.12887336313724518, -0.6261276006698608, -0.07745063304901123, 0.1408565193414688, -0.027239365503191948, -0.06064930185675621, 0.23845764994621277, 0.05874178186058998, -0.2467811405658722, 0.28996142745018005, -0.4334382116794586, 0.026411909610033035, 0.02390831522643566, -0.3930666744709015, -0.05343015119433403, -0.013798928819596767, -0.03626582399010658, -0.08431702852249146, -0.3480244576931, -0.14173582196235657, -0.10429704934358597, 0.27614304423332214, -0.3093971610069275, 0.3391559422016144, -0.1596834361553192, -0.21434177458286285, -0.12942498922348022, 0.02752583660185337, 0.48605242371559143, 0.04348034784197807, 0.09970365464687347, 0.1253850907087326, 0.02560342475771904, -0.3106209337711334, 0.10070642083883286, 0.15451855957508087, 0.2941522002220154, -0.11882753670215607, -0.010397731326520443, 0.1382458209991455, -0.06621773540973663, 0.1894260197877884, 0.14562833309173584, -0.09207150340080261, 0.15960288047790527, -0.03433007001876831, -0.05577749386429787, -0.18556027114391327, -0.007284427527338266, 0.006871192716062069, 0.1802998036146164, 0.20399022102355957, -0.2509247660636902, 0.0992012694478035, -0.23715899884700775, -0.24451328814029694, -0.12316786497831345, 0.08535350114107132, 0.24743087589740753, -0.19652345776557922, 0.16342605650424957, -0.006512903142720461, 0.3367505967617035, 0.14198456704616547, -0.07453657686710358, 0.3665940761566162, -0.2272612750530243, -0.041563794016838074, -0.10113099962472916, -0.04538671299815178, 0.08844989538192749, -0.4045807421207428, -0.05784080550074577, -0.21537308394908905 ]
https://github.com/huggingface/datasets/issues/5425
Sort on multiple keys with datasets.Dataset.sort()
I think we can have the following signature: ```python def sort( self, column_names: Union[str, Sequence[str]], reverse: Union[bool, Sequence[bool]] = False, kind="deprecated", null_placement: str = "last", keep_in_memory: bool = False, load_from_cache_file: bool = True, indices_cache_file_name: Optional[str] = None, writer_batch_size: Optional[int] = 1000, new_fingerprint: Optional[str] = None, ) -> "Dataset": ``` So we should: * rename`column` to `column_names`. `column` is a positional argument, so it's OK to rename it (not marked as positional-only with "/", but still should be fine) * deprecate `kind` * keep `reverse` instead of introducing `sort_keys`, but we should allow passing a list of booleans that defines the sort order of each column from `column_names` to it (`reverse = False` would be equal to `[False] * len(column_names)` and `reverse = True` to `[True] * len(column_names)`)
### Feature request From discussion on forum: https://discuss.huggingface.co/t/datasets-dataset-sort-does-not-preserve-ordering/29065/1 `sort()` does not preserve ordering, and it does not support sorting on multiple columns, nor a key function. The suggested solution: > ... having something similar to pandas and be able to specify multiple columns for sorting. We’re already using pandas under the hood to do the sorting in datasets. The suggested workaround: > convert your dataset to pandas and use `df.sort_values()` ### Motivation Preserved ordering when sorting is very handy when one needs to sort on multiple columns, A and B, so that e.g. whenever A is equal for two or more rows, B is kept sorted. Having a parameter to do this in 🤗datasets would be cleaner than going through pandas and back, and it wouldn't add much complexity to the library. Alternatives: - the possibility to specify multiple keys to sort by with decreasing priority (suggested solution), - the ability to provide a key function for sorting, so that one can manually specify the sorting criteria. ### Your contribution I'll be happy to contribute by submitting a PR. Will get documented on `CONTRIBUTING.MD`. Would love to get thoughts on this, if anyone has anything to add.
127
Sort on multiple keys with datasets.Dataset.sort()
[ 0.028741464018821716, -0.09899337589740753, -0.2973214089870453, 0.11221349984407425, 0.1764691323041916, 0.08357195556163788, 0.06119823083281517, 0.2558813989162445, -0.13195225596427917, 0.04995827376842499, -0.10002277791500092, 0.22852276265621185, 0.005976022221148014, 0.11916109919548035, 0.1299404352903366, -0.1751485913991928, -0.052675873041152954, 0.07647618651390076, 0.10694260150194168, -0.037278253585100174, -0.10407478362321854, -0.018843917176127434, -0.36189672350883484, 0.022627171128988266, 0.16309456527233124, -0.211319699883461, -0.13150985538959503, 0.06319349259138107, -0.20336928963661194, -0.39403992891311646, -0.023737367242574692, 0.3600752353668213, -0.2311311960220337, 0.2830202877521515, -0.00009829093323787674, -0.027034558355808258, -0.15511251986026764, -0.06828892976045609, -0.14293275773525238, -0.05293061584234238, -0.13685062527656555, 0.1365538090467453, -0.31148025393486023, -0.16597580909729004, -0.26916879415512085, -0.517481803894043, 0.07312311977148056, -0.3936796188354492, 0.21545954048633575, 0.11239194869995117, 0.30136850476264954, 0.21242313086986542, 0.08837921172380447, -0.020500464364886284, 0.15879520773887634, -0.038167804479599, 0.03924916312098503, -0.27118930220603943, 0.14484061300754547, 0.15542326867580414, -0.042367320507764816, 0.17660818994045258, -0.06745560467243195, -0.20266829431056976, 0.27615466713905334, -0.04900844767689705, -0.1744646579027176, 0.07352420687675476, 0.276804655790329, -0.048764731734991074, 0.42820027470588684, -0.3786011040210724, -0.3875385820865631, -0.18187670409679413, 0.1576341986656189, 0.041407711803913116, 0.01363010611385107, -0.11205583065748215, 0.1906524896621704, -0.18286876380443573, 0.0253467820584774, -0.04230644553899765, -0.10334239900112152, 0.33909863233566284, -0.21739134192466736, 0.25068655610084534, -0.14904356002807617, -0.05559879541397095, 0.2212914377450943, -0.31704574823379517, 0.11758691817522049, -0.48928478360176086, 0.07492232322692871, 0.12360358983278275, -0.3871307075023651, -0.23457695543766022, 0.41621190309524536, 0.3631003499031067, 0.20420928299427032, -0.23175935447216034, -0.09831859171390533, 0.03442925214767456, 0.11145657300949097, -0.07862799614667892, 0.4601077437400818, 0.23155617713928223, 0.4143107533454895, 0.2871588170528412, 0.10558782517910004, -0.15301452577114105, -0.08470325917005539, 0.008258804678916931, 0.23843777179718018, -0.4598367214202881, -0.11582072824239731, 0.2984207272529602, -0.0024685747921466827, -0.01222578901797533, -0.07282502204179764, -0.13710127770900726, 0.2499946653842926, -0.11843417584896088, 0.32767945528030396, 0.4415939152240753, 0.15942507982254028, 0.015413908287882805, -0.30153194069862366, 0.05728483200073242, 0.04334966465830803, 0.2917996346950531, -0.3173701763153076, -0.016046281903982162, 0.11875352263450623, -0.18779811263084412, 0.06037387251853943, -0.09712766855955124, -0.16569070518016815, 0.122409388422966, 0.1567566990852356, -0.10008503496646881, 0.08057725429534912, 0.06857022643089294, 0.2257465422153473, 0.29695039987564087, 0.11611581593751907, 0.1641055941581726, -0.025623725727200508, -0.12034722417593002, -0.25645431876182556, 0.205649733543396, -0.3393760025501251, -0.20160476863384247, 0.2391362488269806, 0.2643216848373413, 0.12448668479919434, 0.09156861156225204, -0.2836962938308716, 0.10045425593852997, 0.2931644320487976, -0.2490716278553009, -0.1282299906015396, 0.10369186848402023, -0.1263352930545807, -0.1338959038257599, -0.07697287946939468, -0.01695343852043152, -0.23882731795310974, 0.013437679037451744, -0.2867739200592041, 0.0458216592669487, -0.14717240631580353, -0.022884326055645943, -0.1372058242559433, 0.1682179868221283, 0.08400566130876541, 0.4115127623081207, 0.5246119499206543, -0.25035303831100464, -0.5486193299293518, 0.24931985139846802, -0.12953656911849976, -0.316114604473114, 0.16261045634746552, 0.36588165163993835, 0.21764063835144043, -0.1080687940120697, 0.17386585474014282, 0.09656177461147308, 0.06566561013460159, 0.1413278877735138, 0.05509106442332268, 0.026691755279898643, 0.04763496667146683, 0.09746909886598587, 0.18258927762508392, -0.18801520764827728, 0.18442866206169128, -0.12867653369903564, 0.07147156447172165, -0.17986805737018585, -0.2552776038646698, 0.2932296693325043, -0.07146204262971878, -0.04671154171228409, 0.11469095200300217, -0.1888485997915268, -0.2776067554950714, 0.09598945081233978, 0.21691830456256866, -0.19637557864189148, -0.3188058137893677, -0.1703096330165863, -0.15814805030822754, 0.003167852759361267, -0.2981880307197571, 0.43992531299591064, 0.30934813618659973, 0.04590253904461861, -0.14083395898342133, -0.09301429986953735, -0.10139147192239761, 0.07767325639724731, 0.14301806688308716, -0.13094200193881989, -0.18788938224315643, 0.30042821168899536, -0.25594988465309143, 0.31301772594451904, 0.10518334805965424, -0.07078729569911957, 0.2558874189853668, 0.10056102275848389, 0.12523286044597626, 0.3052782714366913, 0.046064846217632294, -0.17728833854198456, 0.13048811256885529, 0.07967263460159302, -0.02715574949979782, 0.14838431775569916, 0.08697950839996338, 0.1438976377248764, -0.011832283809781075, 0.06474629044532776, -0.5371254086494446, 0.6956678628921509, -0.2035532146692276, 0.19834968447685242, 0.15104900300502777, -0.05159931257367134, -0.04776904359459877, 0.26706406474113464, 0.022406242787837982, -0.23311270773410797, 0.18953894078731537, 0.21901406347751617, -0.024510568007826805, 0.10708460211753845, -0.11982258409261703, 0.41455453634262085, 0.6199867129325867, 0.03352299705147743, 0.27068352699279785, -0.12812234461307526, 0.12096802890300751, 0.12044632434844971, 0.09573175758123398, 0.32039573788642883, -0.00476019037887454, 0.36533504724502563, 0.12256555259227753, -0.2140568345785141, -0.004775006789714098, -0.010725472122430801, -0.040854353457689285, 0.03006882406771183, -0.28911444544792175, 0.3847918212413788, 0.22437109053134918, 0.023196067661046982, -0.4351916015148163, 0.019098928198218346, 0.2587398886680603, -0.002195655135437846, -0.25597551465034485, -0.06115487217903137, -0.23312318325042725, -0.23552662134170532, 0.2014453411102295, -0.028508152812719345, -0.2556595206260681, -0.20508043467998505, 0.2772729992866516, -0.18023738265037537, -0.020554974675178528, 0.058181796222925186, 0.06811882555484772, 0.11395329982042313, 0.29818376898765564, -0.04306061565876007, 0.06895627826452255, -0.1549319475889206, 0.0038211180362850428, 0.1969866007566452, 0.19441509246826172, 0.18841761350631714, 0.4552612602710724, -0.023151539266109467, -0.10380826890468597, -0.0008603439200669527, -0.3883145749568939, -0.16494590044021606, -0.16007906198501587, -0.04555778577923775, 0.10475696623325348, 0.07942239940166473, -0.170744851231575, -0.014722604304552078, 0.07637723535299301, 0.239674910902977, -0.2990134060382843, 0.18565014004707336, 0.07611586898565292, -0.24249188601970673, -0.22554217278957367, -0.31050577759742737, 0.1628037840127945, 0.04459526762366295, 0.02515130117535591, -0.009111699648201466, 0.32996299862861633, -0.2689761519432068, -0.06573230773210526, -0.08190502971410751, -0.09226939082145691, -0.015839165076613426, -0.11080092936754227, 0.0911756157875061, 0.26182058453559875, -0.017259590327739716, -0.11627946048974991, -0.17516663670539856, 0.018687555566430092, -0.37253737449645996, 0.096438929438591, -0.08320402354001999, -0.2570739686489105, -0.11962383985519409, 0.2844480574131012, -0.023050813004374504, 0.31526288390159607, 0.3632940351963043, 0.17984257638454437, -0.15952637791633606, -0.2913755476474762, -0.212080717086792, -0.12867677211761475, 0.03576914593577385, 0.06076393648982048, -0.222672238945961, 0.37091925740242004, 0.4100162088871002, 0.314433217048645, -0.31595489382743835, 0.05251911282539368, 0.09986817091703415, 0.0971875935792923, 0.1581433266401291, -0.026691561564803123, -0.3397607207298279, 0.07663605362176895, 0.26961347460746765, 0.2836642265319824, 0.21160617470741272, 0.1588263064622879, -0.004899116232991219, 0.05002809688448906, 0.023800497874617577, -0.16895371675491333, -0.03600868210196495, -0.10271711647510529, -0.09049990773200989, 0.0025359669234603643, 0.17975661158561707, 0.1987525075674057, -0.4322522282600403, -0.01353919692337513, -0.1523052304983139, -0.09588416665792465, -0.2775111496448517, -0.1532660275697708, -0.4073219299316406, -0.0225144661962986, -0.32482507824897766, 0.05860809236764908, 0.24598075449466705, -0.06660757958889008, 0.12772241234779358, 0.20894786715507507, -0.07537244260311127, -0.4535475969314575, 0.7264634966850281, -0.03479468449950218, 0.2244250476360321, 0.1056964322924614, -0.04653359577059746, -0.2877999544143677, 0.386326402425766, -0.0923352986574173, 0.3816564679145813, -0.3733280599117279, 0.4020630717277527, -0.3640495836734772, -0.11360924690961838, -0.2745121121406555, 0.06633970886468887, -0.0886177271604538, -0.3054408133029938, -0.23281055688858032, -0.1869032084941864, -0.056929413229227066, 0.1902729868888855, 0.04687241092324257, 0.0898398756980896, -0.20126931369304657, -0.1646491438150406, -0.11180843412876129, -0.14261658489704132, -0.042835865169763565, -0.043210916221141815, 0.32821163535118103, 0.306610643863678, -0.0194955226033926, 0.17154859006404877, 0.09807342290878296, 0.05853812396526337, 0.06522303074598312, 0.11859067529439926, -0.12706686556339264, -0.23855140805244446, -0.057969171553850174, -0.1155557632446289, 0.12367766350507736, -0.23189283907413483, 0.055988021194934845, 0.08753781020641327, 0.06897284090518951, 0.28997406363487244, 0.07451390475034714, 0.4161418676376343, 0.04203232750296593, -0.31354185938835144, -0.34835514426231384, 0.5198854207992554, -0.03438209369778633, -0.271411657333374, 0.30008918046951294, 0.5188669562339783, -0.34985294938087463, -0.10039042681455612, 0.12252308428287506, 0.45780670642852783, -0.25626036524772644, 0.15132583677768707, 0.08422946184873581, -0.16238678991794586, 0.0760197639465332, -0.15231524407863617, 0.3884741961956024, -0.3539924621582031, -0.38853025436401367, 0.0028728952165693045, 0.0030920403078198433, -0.07987355440855026, 0.37980255484580994, -0.20288437604904175, 0.19962027668952942, 0.030966708436608315, 0.1436246931552887, -0.21247147023677826, 0.1080198884010315, 0.02416945993900299, 0.06602545082569122, -0.413293719291687, 0.258748859167099, -0.014453104697167873, -0.22002233564853668, -0.1026776134967804, 0.15408167243003845, 0.3859541416168213, -0.34680116176605225, 0.020468860864639282, -0.1017046645283699, -0.21351243555545807, 0.2738752067089081, -0.28672537207603455, -0.05902617797255516, 0.0654316172003746, 0.3275730609893799, 0.25089380145072937, 0.2156902253627777, 0.18395817279815674, 0.17460931837558746, 0.09350919723510742, 0.4132477939128876, -0.03079063817858696, -0.12332703173160553, 0.0029667324852198362, -0.09036454558372498, -0.05656089633703232, -0.30132967233657837, 0.3779541850090027, -0.4599745571613312, -0.10072620958089828, 0.23339299857616425, -0.1467258632183075, 0.005664231721311808, 0.033732131123542786, 0.24836429953575134, 0.10704982280731201, -0.2621464729309082, 0.27916207909584045, 0.017606908455491066, 0.021781371906399727, 0.3856351673603058, -0.2298927903175354, 0.1456385850906372, 0.08664967119693756, 0.42799511551856995, 0.19120997190475464, 0.08677171170711517, 0.22853656113147736, 0.13159969449043274, -0.46108412742614746, -0.3208995759487152, -0.10690692067146301, 0.10199175029993057, 0.1377643495798111, 0.2878592908382416, -0.17465543746948242, -0.026994826272130013, 0.12229665368795395, 0.1870105117559433, -0.14917251467704773, -0.029341941699385643, 0.02487516589462757, -0.13401098549365997, 0.06822408735752106, 0.047108255326747894, 0.30334365367889404, 0.22584572434425354, 0.015977801755070686, 0.044641077518463135, -0.0853179469704628, -0.01034301333129406, -0.41374990344047546, 0.011657039634883404, 0.024023350328207016, 0.21102935075759888, 0.11200687289237976, 0.07604470103979111, -0.13820010423660278, -0.033245693892240524, 0.29385697841644287, -0.2629936933517456, -0.1742492914199829, -0.4430278539657593, 0.059456586837768555, -0.005820879712700844, -0.08289095759391785, 0.230892613530159, 0.021758709102869034, -0.34936586022377014, -0.21420831978321075, -0.1783481240272522, 0.2030445635318756, 0.2989426851272583, -0.0071336147375404835, 0.35147884488105774, 0.2581545114517212, -0.0035942327231168747, 0.23585103452205658, 0.19561876356601715, 0.06273454427719116, -0.45853444933891296, 0.15426231920719147, 0.44000306725502014, -0.0585353821516037, 0.07727967947721481, -0.07029365748167038, 0.0784812718629837, 0.2070714235305786, 0.06912847608327866, 0.06716207414865494, -0.38276374340057373, -0.2325223684310913, 0.35732418298721313, 0.5423648953437805, 0.40724581480026245, 0.009469843469560146, -0.11992395669221878, -0.18630734086036682, 0.2812197804450989, -0.423431932926178, -0.3921651542186737, 0.22317716479301453, 0.2112451046705246, 0.04564488306641579, -0.11524758487939835, -0.26262569427490234, 0.11134424805641174, 0.03918910026550293, 0.10051245242357254, -0.06835640221834183, -0.15422244369983673, 0.3816716969013214, 0.34196603298187256, 0.11520474404096603, -0.248460054397583, 0.09961001574993134, -0.0036607254296541214, -0.19121837615966797, 0.5780709981918335, 0.013111012056469917, 0.31486907601356506, 0.0862170159816742, -0.22058995068073273, -0.013476642780005932, -0.2652890086174011, 0.29852157831192017, 0.11329348385334015, 0.049394916743040085, -0.09555695205926895, 0.4409901201725006, -0.03224068507552147, 0.003891852218657732, -0.23988521099090576, -0.3835207223892212, 0.03165460377931595, -0.10211504995822906, -0.19804491102695465, -0.06268967688083649, -0.17793291807174683, 0.08181717991828918, -0.004636696074157953, -0.10522919148206711, -0.04847212880849838, 0.14905807375907898, -0.06979266554117203, 0.2193257361650467, -0.7102015614509583, 0.35685229301452637, -0.015394576825201511, 0.21962790191173553, -0.006895689759403467, 0.027445456013083458, 0.19851267337799072, 0.13520324230194092, 0.07749417424201965, -0.1274237483739853, 0.06324156373739243, -0.08694829046726227, 0.017552901059389114, -0.01817288063466549, -0.04402824118733406, -0.1820732206106186, -0.06733627617359161, -0.2454107105731964, -0.29899415373802185, 0.19106021523475647, 0.4642946422100067, 0.257941335439682, -0.21172159910202026, 0.21024756133556366, 0.1895163655281067, -0.0018318326910957694, -0.04670119285583496, 0.007600108161568642, -0.3009836971759796, -0.3384607136249542, 0.06299804151058197, 0.11697909981012344, -0.027359738945961, -0.39263486862182617, 0.037846047431230545, 0.008233655244112015, -0.0022859221789985895, -0.46609991788864136, 0.190652534365654, 0.036641042679548264, 0.3921414613723755, 0.13660885393619537, 0.08760827034711838, -0.19138385355472565, -0.12887336313724518, -0.6261276006698608, -0.07745063304901123, 0.1408565193414688, -0.027239365503191948, -0.06064930185675621, 0.23845764994621277, 0.05874178186058998, -0.2467811405658722, 0.28996142745018005, -0.4334382116794586, 0.026411909610033035, 0.02390831522643566, -0.3930666744709015, -0.05343015119433403, -0.013798928819596767, -0.03626582399010658, -0.08431702852249146, -0.3480244576931, -0.14173582196235657, -0.10429704934358597, 0.27614304423332214, -0.3093971610069275, 0.3391559422016144, -0.1596834361553192, -0.21434177458286285, -0.12942498922348022, 0.02752583660185337, 0.48605242371559143, 0.04348034784197807, 0.09970365464687347, 0.1253850907087326, 0.02560342475771904, -0.3106209337711334, 0.10070642083883286, 0.15451855957508087, 0.2941522002220154, -0.11882753670215607, -0.010397731326520443, 0.1382458209991455, -0.06621773540973663, 0.1894260197877884, 0.14562833309173584, -0.09207150340080261, 0.15960288047790527, -0.03433007001876831, -0.05577749386429787, -0.18556027114391327, -0.007284427527338266, 0.006871192716062069, 0.1802998036146164, 0.20399022102355957, -0.2509247660636902, 0.0992012694478035, -0.23715899884700775, -0.24451328814029694, -0.12316786497831345, 0.08535350114107132, 0.24743087589740753, -0.19652345776557922, 0.16342605650424957, -0.006512903142720461, 0.3367505967617035, 0.14198456704616547, -0.07453657686710358, 0.3665940761566162, -0.2272612750530243, -0.041563794016838074, -0.10113099962472916, -0.04538671299815178, 0.08844989538192749, -0.4045807421207428, -0.05784080550074577, -0.21537308394908905 ]
https://github.com/huggingface/datasets/issues/5425
Sort on multiple keys with datasets.Dataset.sort()
I am pretty much done with the PR. Just one clarification: `Sequence` in `arrow_dataset.py` is a custom dataclass from `features.py` instead of the `type.hinting` class `Sequence` from Python. Do you suggest using that custom `Sequence` class somehow ? Otherwise signature currently reads instead: ```Python def sort( self, column_names: Union[str, List[str]], reverse: Union[bool, List[bool]] = False, kind = "deprecated", null_placement: str = "last", keep_in_memory: bool = False, load_from_cache_file: bool = True, indices_cache_file_name: Optional[str] = None, writer_batch_size: Optional[int] = 1000, new_fingerprint: Optional[str] = None, ) ``` Also, to maintain backwards compatibility, I added conditionals for `null_placement`, because pyarrow's `null_placement` only accepts `at_start` and `at_end`, and not `last` and `first`. If that is all good, I think I can open the PR.
### Feature request From discussion on forum: https://discuss.huggingface.co/t/datasets-dataset-sort-does-not-preserve-ordering/29065/1 `sort()` does not preserve ordering, and it does not support sorting on multiple columns, nor a key function. The suggested solution: > ... having something similar to pandas and be able to specify multiple columns for sorting. We’re already using pandas under the hood to do the sorting in datasets. The suggested workaround: > convert your dataset to pandas and use `df.sort_values()` ### Motivation Preserved ordering when sorting is very handy when one needs to sort on multiple columns, A and B, so that e.g. whenever A is equal for two or more rows, B is kept sorted. Having a parameter to do this in 🤗datasets would be cleaner than going through pandas and back, and it wouldn't add much complexity to the library. Alternatives: - the possibility to specify multiple keys to sort by with decreasing priority (suggested solution), - the ability to provide a key function for sorting, so that one can manually specify the sorting criteria. ### Your contribution I'll be happy to contribute by submitting a PR. Will get documented on `CONTRIBUTING.MD`. Would love to get thoughts on this, if anyone has anything to add.
119
Sort on multiple keys with datasets.Dataset.sort()
[ 0.028741464018821716, -0.09899337589740753, -0.2973214089870453, 0.11221349984407425, 0.1764691323041916, 0.08357195556163788, 0.06119823083281517, 0.2558813989162445, -0.13195225596427917, 0.04995827376842499, -0.10002277791500092, 0.22852276265621185, 0.005976022221148014, 0.11916109919548035, 0.1299404352903366, -0.1751485913991928, -0.052675873041152954, 0.07647618651390076, 0.10694260150194168, -0.037278253585100174, -0.10407478362321854, -0.018843917176127434, -0.36189672350883484, 0.022627171128988266, 0.16309456527233124, -0.211319699883461, -0.13150985538959503, 0.06319349259138107, -0.20336928963661194, -0.39403992891311646, -0.023737367242574692, 0.3600752353668213, -0.2311311960220337, 0.2830202877521515, -0.00009829093323787674, -0.027034558355808258, -0.15511251986026764, -0.06828892976045609, -0.14293275773525238, -0.05293061584234238, -0.13685062527656555, 0.1365538090467453, -0.31148025393486023, -0.16597580909729004, -0.26916879415512085, -0.517481803894043, 0.07312311977148056, -0.3936796188354492, 0.21545954048633575, 0.11239194869995117, 0.30136850476264954, 0.21242313086986542, 0.08837921172380447, -0.020500464364886284, 0.15879520773887634, -0.038167804479599, 0.03924916312098503, -0.27118930220603943, 0.14484061300754547, 0.15542326867580414, -0.042367320507764816, 0.17660818994045258, -0.06745560467243195, -0.20266829431056976, 0.27615466713905334, -0.04900844767689705, -0.1744646579027176, 0.07352420687675476, 0.276804655790329, -0.048764731734991074, 0.42820027470588684, -0.3786011040210724, -0.3875385820865631, -0.18187670409679413, 0.1576341986656189, 0.041407711803913116, 0.01363010611385107, -0.11205583065748215, 0.1906524896621704, -0.18286876380443573, 0.0253467820584774, -0.04230644553899765, -0.10334239900112152, 0.33909863233566284, -0.21739134192466736, 0.25068655610084534, -0.14904356002807617, -0.05559879541397095, 0.2212914377450943, -0.31704574823379517, 0.11758691817522049, -0.48928478360176086, 0.07492232322692871, 0.12360358983278275, -0.3871307075023651, -0.23457695543766022, 0.41621190309524536, 0.3631003499031067, 0.20420928299427032, -0.23175935447216034, -0.09831859171390533, 0.03442925214767456, 0.11145657300949097, -0.07862799614667892, 0.4601077437400818, 0.23155617713928223, 0.4143107533454895, 0.2871588170528412, 0.10558782517910004, -0.15301452577114105, -0.08470325917005539, 0.008258804678916931, 0.23843777179718018, -0.4598367214202881, -0.11582072824239731, 0.2984207272529602, -0.0024685747921466827, -0.01222578901797533, -0.07282502204179764, -0.13710127770900726, 0.2499946653842926, -0.11843417584896088, 0.32767945528030396, 0.4415939152240753, 0.15942507982254028, 0.015413908287882805, -0.30153194069862366, 0.05728483200073242, 0.04334966465830803, 0.2917996346950531, -0.3173701763153076, -0.016046281903982162, 0.11875352263450623, -0.18779811263084412, 0.06037387251853943, -0.09712766855955124, -0.16569070518016815, 0.122409388422966, 0.1567566990852356, -0.10008503496646881, 0.08057725429534912, 0.06857022643089294, 0.2257465422153473, 0.29695039987564087, 0.11611581593751907, 0.1641055941581726, -0.025623725727200508, -0.12034722417593002, -0.25645431876182556, 0.205649733543396, -0.3393760025501251, -0.20160476863384247, 0.2391362488269806, 0.2643216848373413, 0.12448668479919434, 0.09156861156225204, -0.2836962938308716, 0.10045425593852997, 0.2931644320487976, -0.2490716278553009, -0.1282299906015396, 0.10369186848402023, -0.1263352930545807, -0.1338959038257599, -0.07697287946939468, -0.01695343852043152, -0.23882731795310974, 0.013437679037451744, -0.2867739200592041, 0.0458216592669487, -0.14717240631580353, -0.022884326055645943, -0.1372058242559433, 0.1682179868221283, 0.08400566130876541, 0.4115127623081207, 0.5246119499206543, -0.25035303831100464, -0.5486193299293518, 0.24931985139846802, -0.12953656911849976, -0.316114604473114, 0.16261045634746552, 0.36588165163993835, 0.21764063835144043, -0.1080687940120697, 0.17386585474014282, 0.09656177461147308, 0.06566561013460159, 0.1413278877735138, 0.05509106442332268, 0.026691755279898643, 0.04763496667146683, 0.09746909886598587, 0.18258927762508392, -0.18801520764827728, 0.18442866206169128, -0.12867653369903564, 0.07147156447172165, -0.17986805737018585, -0.2552776038646698, 0.2932296693325043, -0.07146204262971878, -0.04671154171228409, 0.11469095200300217, -0.1888485997915268, -0.2776067554950714, 0.09598945081233978, 0.21691830456256866, -0.19637557864189148, -0.3188058137893677, -0.1703096330165863, -0.15814805030822754, 0.003167852759361267, -0.2981880307197571, 0.43992531299591064, 0.30934813618659973, 0.04590253904461861, -0.14083395898342133, -0.09301429986953735, -0.10139147192239761, 0.07767325639724731, 0.14301806688308716, -0.13094200193881989, -0.18788938224315643, 0.30042821168899536, -0.25594988465309143, 0.31301772594451904, 0.10518334805965424, -0.07078729569911957, 0.2558874189853668, 0.10056102275848389, 0.12523286044597626, 0.3052782714366913, 0.046064846217632294, -0.17728833854198456, 0.13048811256885529, 0.07967263460159302, -0.02715574949979782, 0.14838431775569916, 0.08697950839996338, 0.1438976377248764, -0.011832283809781075, 0.06474629044532776, -0.5371254086494446, 0.6956678628921509, -0.2035532146692276, 0.19834968447685242, 0.15104900300502777, -0.05159931257367134, -0.04776904359459877, 0.26706406474113464, 0.022406242787837982, -0.23311270773410797, 0.18953894078731537, 0.21901406347751617, -0.024510568007826805, 0.10708460211753845, -0.11982258409261703, 0.41455453634262085, 0.6199867129325867, 0.03352299705147743, 0.27068352699279785, -0.12812234461307526, 0.12096802890300751, 0.12044632434844971, 0.09573175758123398, 0.32039573788642883, -0.00476019037887454, 0.36533504724502563, 0.12256555259227753, -0.2140568345785141, -0.004775006789714098, -0.010725472122430801, -0.040854353457689285, 0.03006882406771183, -0.28911444544792175, 0.3847918212413788, 0.22437109053134918, 0.023196067661046982, -0.4351916015148163, 0.019098928198218346, 0.2587398886680603, -0.002195655135437846, -0.25597551465034485, -0.06115487217903137, -0.23312318325042725, -0.23552662134170532, 0.2014453411102295, -0.028508152812719345, -0.2556595206260681, -0.20508043467998505, 0.2772729992866516, -0.18023738265037537, -0.020554974675178528, 0.058181796222925186, 0.06811882555484772, 0.11395329982042313, 0.29818376898765564, -0.04306061565876007, 0.06895627826452255, -0.1549319475889206, 0.0038211180362850428, 0.1969866007566452, 0.19441509246826172, 0.18841761350631714, 0.4552612602710724, -0.023151539266109467, -0.10380826890468597, -0.0008603439200669527, -0.3883145749568939, -0.16494590044021606, -0.16007906198501587, -0.04555778577923775, 0.10475696623325348, 0.07942239940166473, -0.170744851231575, -0.014722604304552078, 0.07637723535299301, 0.239674910902977, -0.2990134060382843, 0.18565014004707336, 0.07611586898565292, -0.24249188601970673, -0.22554217278957367, -0.31050577759742737, 0.1628037840127945, 0.04459526762366295, 0.02515130117535591, -0.009111699648201466, 0.32996299862861633, -0.2689761519432068, -0.06573230773210526, -0.08190502971410751, -0.09226939082145691, -0.015839165076613426, -0.11080092936754227, 0.0911756157875061, 0.26182058453559875, -0.017259590327739716, -0.11627946048974991, -0.17516663670539856, 0.018687555566430092, -0.37253737449645996, 0.096438929438591, -0.08320402354001999, -0.2570739686489105, -0.11962383985519409, 0.2844480574131012, -0.023050813004374504, 0.31526288390159607, 0.3632940351963043, 0.17984257638454437, -0.15952637791633606, -0.2913755476474762, -0.212080717086792, -0.12867677211761475, 0.03576914593577385, 0.06076393648982048, -0.222672238945961, 0.37091925740242004, 0.4100162088871002, 0.314433217048645, -0.31595489382743835, 0.05251911282539368, 0.09986817091703415, 0.0971875935792923, 0.1581433266401291, -0.026691561564803123, -0.3397607207298279, 0.07663605362176895, 0.26961347460746765, 0.2836642265319824, 0.21160617470741272, 0.1588263064622879, -0.004899116232991219, 0.05002809688448906, 0.023800497874617577, -0.16895371675491333, -0.03600868210196495, -0.10271711647510529, -0.09049990773200989, 0.0025359669234603643, 0.17975661158561707, 0.1987525075674057, -0.4322522282600403, -0.01353919692337513, -0.1523052304983139, -0.09588416665792465, -0.2775111496448517, -0.1532660275697708, -0.4073219299316406, -0.0225144661962986, -0.32482507824897766, 0.05860809236764908, 0.24598075449466705, -0.06660757958889008, 0.12772241234779358, 0.20894786715507507, -0.07537244260311127, -0.4535475969314575, 0.7264634966850281, -0.03479468449950218, 0.2244250476360321, 0.1056964322924614, -0.04653359577059746, -0.2877999544143677, 0.386326402425766, -0.0923352986574173, 0.3816564679145813, -0.3733280599117279, 0.4020630717277527, -0.3640495836734772, -0.11360924690961838, -0.2745121121406555, 0.06633970886468887, -0.0886177271604538, -0.3054408133029938, -0.23281055688858032, -0.1869032084941864, -0.056929413229227066, 0.1902729868888855, 0.04687241092324257, 0.0898398756980896, -0.20126931369304657, -0.1646491438150406, -0.11180843412876129, -0.14261658489704132, -0.042835865169763565, -0.043210916221141815, 0.32821163535118103, 0.306610643863678, -0.0194955226033926, 0.17154859006404877, 0.09807342290878296, 0.05853812396526337, 0.06522303074598312, 0.11859067529439926, -0.12706686556339264, -0.23855140805244446, -0.057969171553850174, -0.1155557632446289, 0.12367766350507736, -0.23189283907413483, 0.055988021194934845, 0.08753781020641327, 0.06897284090518951, 0.28997406363487244, 0.07451390475034714, 0.4161418676376343, 0.04203232750296593, -0.31354185938835144, -0.34835514426231384, 0.5198854207992554, -0.03438209369778633, -0.271411657333374, 0.30008918046951294, 0.5188669562339783, -0.34985294938087463, -0.10039042681455612, 0.12252308428287506, 0.45780670642852783, -0.25626036524772644, 0.15132583677768707, 0.08422946184873581, -0.16238678991794586, 0.0760197639465332, -0.15231524407863617, 0.3884741961956024, -0.3539924621582031, -0.38853025436401367, 0.0028728952165693045, 0.0030920403078198433, -0.07987355440855026, 0.37980255484580994, -0.20288437604904175, 0.19962027668952942, 0.030966708436608315, 0.1436246931552887, -0.21247147023677826, 0.1080198884010315, 0.02416945993900299, 0.06602545082569122, -0.413293719291687, 0.258748859167099, -0.014453104697167873, -0.22002233564853668, -0.1026776134967804, 0.15408167243003845, 0.3859541416168213, -0.34680116176605225, 0.020468860864639282, -0.1017046645283699, -0.21351243555545807, 0.2738752067089081, -0.28672537207603455, -0.05902617797255516, 0.0654316172003746, 0.3275730609893799, 0.25089380145072937, 0.2156902253627777, 0.18395817279815674, 0.17460931837558746, 0.09350919723510742, 0.4132477939128876, -0.03079063817858696, -0.12332703173160553, 0.0029667324852198362, -0.09036454558372498, -0.05656089633703232, -0.30132967233657837, 0.3779541850090027, -0.4599745571613312, -0.10072620958089828, 0.23339299857616425, -0.1467258632183075, 0.005664231721311808, 0.033732131123542786, 0.24836429953575134, 0.10704982280731201, -0.2621464729309082, 0.27916207909584045, 0.017606908455491066, 0.021781371906399727, 0.3856351673603058, -0.2298927903175354, 0.1456385850906372, 0.08664967119693756, 0.42799511551856995, 0.19120997190475464, 0.08677171170711517, 0.22853656113147736, 0.13159969449043274, -0.46108412742614746, -0.3208995759487152, -0.10690692067146301, 0.10199175029993057, 0.1377643495798111, 0.2878592908382416, -0.17465543746948242, -0.026994826272130013, 0.12229665368795395, 0.1870105117559433, -0.14917251467704773, -0.029341941699385643, 0.02487516589462757, -0.13401098549365997, 0.06822408735752106, 0.047108255326747894, 0.30334365367889404, 0.22584572434425354, 0.015977801755070686, 0.044641077518463135, -0.0853179469704628, -0.01034301333129406, -0.41374990344047546, 0.011657039634883404, 0.024023350328207016, 0.21102935075759888, 0.11200687289237976, 0.07604470103979111, -0.13820010423660278, -0.033245693892240524, 0.29385697841644287, -0.2629936933517456, -0.1742492914199829, -0.4430278539657593, 0.059456586837768555, -0.005820879712700844, -0.08289095759391785, 0.230892613530159, 0.021758709102869034, -0.34936586022377014, -0.21420831978321075, -0.1783481240272522, 0.2030445635318756, 0.2989426851272583, -0.0071336147375404835, 0.35147884488105774, 0.2581545114517212, -0.0035942327231168747, 0.23585103452205658, 0.19561876356601715, 0.06273454427719116, -0.45853444933891296, 0.15426231920719147, 0.44000306725502014, -0.0585353821516037, 0.07727967947721481, -0.07029365748167038, 0.0784812718629837, 0.2070714235305786, 0.06912847608327866, 0.06716207414865494, -0.38276374340057373, -0.2325223684310913, 0.35732418298721313, 0.5423648953437805, 0.40724581480026245, 0.009469843469560146, -0.11992395669221878, -0.18630734086036682, 0.2812197804450989, -0.423431932926178, -0.3921651542186737, 0.22317716479301453, 0.2112451046705246, 0.04564488306641579, -0.11524758487939835, -0.26262569427490234, 0.11134424805641174, 0.03918910026550293, 0.10051245242357254, -0.06835640221834183, -0.15422244369983673, 0.3816716969013214, 0.34196603298187256, 0.11520474404096603, -0.248460054397583, 0.09961001574993134, -0.0036607254296541214, -0.19121837615966797, 0.5780709981918335, 0.013111012056469917, 0.31486907601356506, 0.0862170159816742, -0.22058995068073273, -0.013476642780005932, -0.2652890086174011, 0.29852157831192017, 0.11329348385334015, 0.049394916743040085, -0.09555695205926895, 0.4409901201725006, -0.03224068507552147, 0.003891852218657732, -0.23988521099090576, -0.3835207223892212, 0.03165460377931595, -0.10211504995822906, -0.19804491102695465, -0.06268967688083649, -0.17793291807174683, 0.08181717991828918, -0.004636696074157953, -0.10522919148206711, -0.04847212880849838, 0.14905807375907898, -0.06979266554117203, 0.2193257361650467, -0.7102015614509583, 0.35685229301452637, -0.015394576825201511, 0.21962790191173553, -0.006895689759403467, 0.027445456013083458, 0.19851267337799072, 0.13520324230194092, 0.07749417424201965, -0.1274237483739853, 0.06324156373739243, -0.08694829046726227, 0.017552901059389114, -0.01817288063466549, -0.04402824118733406, -0.1820732206106186, -0.06733627617359161, -0.2454107105731964, -0.29899415373802185, 0.19106021523475647, 0.4642946422100067, 0.257941335439682, -0.21172159910202026, 0.21024756133556366, 0.1895163655281067, -0.0018318326910957694, -0.04670119285583496, 0.007600108161568642, -0.3009836971759796, -0.3384607136249542, 0.06299804151058197, 0.11697909981012344, -0.027359738945961, -0.39263486862182617, 0.037846047431230545, 0.008233655244112015, -0.0022859221789985895, -0.46609991788864136, 0.190652534365654, 0.036641042679548264, 0.3921414613723755, 0.13660885393619537, 0.08760827034711838, -0.19138385355472565, -0.12887336313724518, -0.6261276006698608, -0.07745063304901123, 0.1408565193414688, -0.027239365503191948, -0.06064930185675621, 0.23845764994621277, 0.05874178186058998, -0.2467811405658722, 0.28996142745018005, -0.4334382116794586, 0.026411909610033035, 0.02390831522643566, -0.3930666744709015, -0.05343015119433403, -0.013798928819596767, -0.03626582399010658, -0.08431702852249146, -0.3480244576931, -0.14173582196235657, -0.10429704934358597, 0.27614304423332214, -0.3093971610069275, 0.3391559422016144, -0.1596834361553192, -0.21434177458286285, -0.12942498922348022, 0.02752583660185337, 0.48605242371559143, 0.04348034784197807, 0.09970365464687347, 0.1253850907087326, 0.02560342475771904, -0.3106209337711334, 0.10070642083883286, 0.15451855957508087, 0.2941522002220154, -0.11882753670215607, -0.010397731326520443, 0.1382458209991455, -0.06621773540973663, 0.1894260197877884, 0.14562833309173584, -0.09207150340080261, 0.15960288047790527, -0.03433007001876831, -0.05577749386429787, -0.18556027114391327, -0.007284427527338266, 0.006871192716062069, 0.1802998036146164, 0.20399022102355957, -0.2509247660636902, 0.0992012694478035, -0.23715899884700775, -0.24451328814029694, -0.12316786497831345, 0.08535350114107132, 0.24743087589740753, -0.19652345776557922, 0.16342605650424957, -0.006512903142720461, 0.3367505967617035, 0.14198456704616547, -0.07453657686710358, 0.3665940761566162, -0.2272612750530243, -0.041563794016838074, -0.10113099962472916, -0.04538671299815178, 0.08844989538192749, -0.4045807421207428, -0.05784080550074577, -0.21537308394908905 ]
https://github.com/huggingface/datasets/issues/5425
Sort on multiple keys with datasets.Dataset.sort()
I meant `typing.Sequence` (`datasets.Sequence` is a feature type). Regarding `null_placement`, I think we can support both `at_start` and `at_end`, and `last` and `first` (for backward compatibility; convert internally to `at_end` and `at_start` respectively).
### Feature request From discussion on forum: https://discuss.huggingface.co/t/datasets-dataset-sort-does-not-preserve-ordering/29065/1 `sort()` does not preserve ordering, and it does not support sorting on multiple columns, nor a key function. The suggested solution: > ... having something similar to pandas and be able to specify multiple columns for sorting. We’re already using pandas under the hood to do the sorting in datasets. The suggested workaround: > convert your dataset to pandas and use `df.sort_values()` ### Motivation Preserved ordering when sorting is very handy when one needs to sort on multiple columns, A and B, so that e.g. whenever A is equal for two or more rows, B is kept sorted. Having a parameter to do this in 🤗datasets would be cleaner than going through pandas and back, and it wouldn't add much complexity to the library. Alternatives: - the possibility to specify multiple keys to sort by with decreasing priority (suggested solution), - the ability to provide a key function for sorting, so that one can manually specify the sorting criteria. ### Your contribution I'll be happy to contribute by submitting a PR. Will get documented on `CONTRIBUTING.MD`. Would love to get thoughts on this, if anyone has anything to add.
33
Sort on multiple keys with datasets.Dataset.sort()
[ 0.028741464018821716, -0.09899337589740753, -0.2973214089870453, 0.11221349984407425, 0.1764691323041916, 0.08357195556163788, 0.06119823083281517, 0.2558813989162445, -0.13195225596427917, 0.04995827376842499, -0.10002277791500092, 0.22852276265621185, 0.005976022221148014, 0.11916109919548035, 0.1299404352903366, -0.1751485913991928, -0.052675873041152954, 0.07647618651390076, 0.10694260150194168, -0.037278253585100174, -0.10407478362321854, -0.018843917176127434, -0.36189672350883484, 0.022627171128988266, 0.16309456527233124, -0.211319699883461, -0.13150985538959503, 0.06319349259138107, -0.20336928963661194, -0.39403992891311646, -0.023737367242574692, 0.3600752353668213, -0.2311311960220337, 0.2830202877521515, -0.00009829093323787674, -0.027034558355808258, -0.15511251986026764, -0.06828892976045609, -0.14293275773525238, -0.05293061584234238, -0.13685062527656555, 0.1365538090467453, -0.31148025393486023, -0.16597580909729004, -0.26916879415512085, -0.517481803894043, 0.07312311977148056, -0.3936796188354492, 0.21545954048633575, 0.11239194869995117, 0.30136850476264954, 0.21242313086986542, 0.08837921172380447, -0.020500464364886284, 0.15879520773887634, -0.038167804479599, 0.03924916312098503, -0.27118930220603943, 0.14484061300754547, 0.15542326867580414, -0.042367320507764816, 0.17660818994045258, -0.06745560467243195, -0.20266829431056976, 0.27615466713905334, -0.04900844767689705, -0.1744646579027176, 0.07352420687675476, 0.276804655790329, -0.048764731734991074, 0.42820027470588684, -0.3786011040210724, -0.3875385820865631, -0.18187670409679413, 0.1576341986656189, 0.041407711803913116, 0.01363010611385107, -0.11205583065748215, 0.1906524896621704, -0.18286876380443573, 0.0253467820584774, -0.04230644553899765, -0.10334239900112152, 0.33909863233566284, -0.21739134192466736, 0.25068655610084534, -0.14904356002807617, -0.05559879541397095, 0.2212914377450943, -0.31704574823379517, 0.11758691817522049, -0.48928478360176086, 0.07492232322692871, 0.12360358983278275, -0.3871307075023651, -0.23457695543766022, 0.41621190309524536, 0.3631003499031067, 0.20420928299427032, -0.23175935447216034, -0.09831859171390533, 0.03442925214767456, 0.11145657300949097, -0.07862799614667892, 0.4601077437400818, 0.23155617713928223, 0.4143107533454895, 0.2871588170528412, 0.10558782517910004, -0.15301452577114105, -0.08470325917005539, 0.008258804678916931, 0.23843777179718018, -0.4598367214202881, -0.11582072824239731, 0.2984207272529602, -0.0024685747921466827, -0.01222578901797533, -0.07282502204179764, -0.13710127770900726, 0.2499946653842926, -0.11843417584896088, 0.32767945528030396, 0.4415939152240753, 0.15942507982254028, 0.015413908287882805, -0.30153194069862366, 0.05728483200073242, 0.04334966465830803, 0.2917996346950531, -0.3173701763153076, -0.016046281903982162, 0.11875352263450623, -0.18779811263084412, 0.06037387251853943, -0.09712766855955124, -0.16569070518016815, 0.122409388422966, 0.1567566990852356, -0.10008503496646881, 0.08057725429534912, 0.06857022643089294, 0.2257465422153473, 0.29695039987564087, 0.11611581593751907, 0.1641055941581726, -0.025623725727200508, -0.12034722417593002, -0.25645431876182556, 0.205649733543396, -0.3393760025501251, -0.20160476863384247, 0.2391362488269806, 0.2643216848373413, 0.12448668479919434, 0.09156861156225204, -0.2836962938308716, 0.10045425593852997, 0.2931644320487976, -0.2490716278553009, -0.1282299906015396, 0.10369186848402023, -0.1263352930545807, -0.1338959038257599, -0.07697287946939468, -0.01695343852043152, -0.23882731795310974, 0.013437679037451744, -0.2867739200592041, 0.0458216592669487, -0.14717240631580353, -0.022884326055645943, -0.1372058242559433, 0.1682179868221283, 0.08400566130876541, 0.4115127623081207, 0.5246119499206543, -0.25035303831100464, -0.5486193299293518, 0.24931985139846802, -0.12953656911849976, -0.316114604473114, 0.16261045634746552, 0.36588165163993835, 0.21764063835144043, -0.1080687940120697, 0.17386585474014282, 0.09656177461147308, 0.06566561013460159, 0.1413278877735138, 0.05509106442332268, 0.026691755279898643, 0.04763496667146683, 0.09746909886598587, 0.18258927762508392, -0.18801520764827728, 0.18442866206169128, -0.12867653369903564, 0.07147156447172165, -0.17986805737018585, -0.2552776038646698, 0.2932296693325043, -0.07146204262971878, -0.04671154171228409, 0.11469095200300217, -0.1888485997915268, -0.2776067554950714, 0.09598945081233978, 0.21691830456256866, -0.19637557864189148, -0.3188058137893677, -0.1703096330165863, -0.15814805030822754, 0.003167852759361267, -0.2981880307197571, 0.43992531299591064, 0.30934813618659973, 0.04590253904461861, -0.14083395898342133, -0.09301429986953735, -0.10139147192239761, 0.07767325639724731, 0.14301806688308716, -0.13094200193881989, -0.18788938224315643, 0.30042821168899536, -0.25594988465309143, 0.31301772594451904, 0.10518334805965424, -0.07078729569911957, 0.2558874189853668, 0.10056102275848389, 0.12523286044597626, 0.3052782714366913, 0.046064846217632294, -0.17728833854198456, 0.13048811256885529, 0.07967263460159302, -0.02715574949979782, 0.14838431775569916, 0.08697950839996338, 0.1438976377248764, -0.011832283809781075, 0.06474629044532776, -0.5371254086494446, 0.6956678628921509, -0.2035532146692276, 0.19834968447685242, 0.15104900300502777, -0.05159931257367134, -0.04776904359459877, 0.26706406474113464, 0.022406242787837982, -0.23311270773410797, 0.18953894078731537, 0.21901406347751617, -0.024510568007826805, 0.10708460211753845, -0.11982258409261703, 0.41455453634262085, 0.6199867129325867, 0.03352299705147743, 0.27068352699279785, -0.12812234461307526, 0.12096802890300751, 0.12044632434844971, 0.09573175758123398, 0.32039573788642883, -0.00476019037887454, 0.36533504724502563, 0.12256555259227753, -0.2140568345785141, -0.004775006789714098, -0.010725472122430801, -0.040854353457689285, 0.03006882406771183, -0.28911444544792175, 0.3847918212413788, 0.22437109053134918, 0.023196067661046982, -0.4351916015148163, 0.019098928198218346, 0.2587398886680603, -0.002195655135437846, -0.25597551465034485, -0.06115487217903137, -0.23312318325042725, -0.23552662134170532, 0.2014453411102295, -0.028508152812719345, -0.2556595206260681, -0.20508043467998505, 0.2772729992866516, -0.18023738265037537, -0.020554974675178528, 0.058181796222925186, 0.06811882555484772, 0.11395329982042313, 0.29818376898765564, -0.04306061565876007, 0.06895627826452255, -0.1549319475889206, 0.0038211180362850428, 0.1969866007566452, 0.19441509246826172, 0.18841761350631714, 0.4552612602710724, -0.023151539266109467, -0.10380826890468597, -0.0008603439200669527, -0.3883145749568939, -0.16494590044021606, -0.16007906198501587, -0.04555778577923775, 0.10475696623325348, 0.07942239940166473, -0.170744851231575, -0.014722604304552078, 0.07637723535299301, 0.239674910902977, -0.2990134060382843, 0.18565014004707336, 0.07611586898565292, -0.24249188601970673, -0.22554217278957367, -0.31050577759742737, 0.1628037840127945, 0.04459526762366295, 0.02515130117535591, -0.009111699648201466, 0.32996299862861633, -0.2689761519432068, -0.06573230773210526, -0.08190502971410751, -0.09226939082145691, -0.015839165076613426, -0.11080092936754227, 0.0911756157875061, 0.26182058453559875, -0.017259590327739716, -0.11627946048974991, -0.17516663670539856, 0.018687555566430092, -0.37253737449645996, 0.096438929438591, -0.08320402354001999, -0.2570739686489105, -0.11962383985519409, 0.2844480574131012, -0.023050813004374504, 0.31526288390159607, 0.3632940351963043, 0.17984257638454437, -0.15952637791633606, -0.2913755476474762, -0.212080717086792, -0.12867677211761475, 0.03576914593577385, 0.06076393648982048, -0.222672238945961, 0.37091925740242004, 0.4100162088871002, 0.314433217048645, -0.31595489382743835, 0.05251911282539368, 0.09986817091703415, 0.0971875935792923, 0.1581433266401291, -0.026691561564803123, -0.3397607207298279, 0.07663605362176895, 0.26961347460746765, 0.2836642265319824, 0.21160617470741272, 0.1588263064622879, -0.004899116232991219, 0.05002809688448906, 0.023800497874617577, -0.16895371675491333, -0.03600868210196495, -0.10271711647510529, -0.09049990773200989, 0.0025359669234603643, 0.17975661158561707, 0.1987525075674057, -0.4322522282600403, -0.01353919692337513, -0.1523052304983139, -0.09588416665792465, -0.2775111496448517, -0.1532660275697708, -0.4073219299316406, -0.0225144661962986, -0.32482507824897766, 0.05860809236764908, 0.24598075449466705, -0.06660757958889008, 0.12772241234779358, 0.20894786715507507, -0.07537244260311127, -0.4535475969314575, 0.7264634966850281, -0.03479468449950218, 0.2244250476360321, 0.1056964322924614, -0.04653359577059746, -0.2877999544143677, 0.386326402425766, -0.0923352986574173, 0.3816564679145813, -0.3733280599117279, 0.4020630717277527, -0.3640495836734772, -0.11360924690961838, -0.2745121121406555, 0.06633970886468887, -0.0886177271604538, -0.3054408133029938, -0.23281055688858032, -0.1869032084941864, -0.056929413229227066, 0.1902729868888855, 0.04687241092324257, 0.0898398756980896, -0.20126931369304657, -0.1646491438150406, -0.11180843412876129, -0.14261658489704132, -0.042835865169763565, -0.043210916221141815, 0.32821163535118103, 0.306610643863678, -0.0194955226033926, 0.17154859006404877, 0.09807342290878296, 0.05853812396526337, 0.06522303074598312, 0.11859067529439926, -0.12706686556339264, -0.23855140805244446, -0.057969171553850174, -0.1155557632446289, 0.12367766350507736, -0.23189283907413483, 0.055988021194934845, 0.08753781020641327, 0.06897284090518951, 0.28997406363487244, 0.07451390475034714, 0.4161418676376343, 0.04203232750296593, -0.31354185938835144, -0.34835514426231384, 0.5198854207992554, -0.03438209369778633, -0.271411657333374, 0.30008918046951294, 0.5188669562339783, -0.34985294938087463, -0.10039042681455612, 0.12252308428287506, 0.45780670642852783, -0.25626036524772644, 0.15132583677768707, 0.08422946184873581, -0.16238678991794586, 0.0760197639465332, -0.15231524407863617, 0.3884741961956024, -0.3539924621582031, -0.38853025436401367, 0.0028728952165693045, 0.0030920403078198433, -0.07987355440855026, 0.37980255484580994, -0.20288437604904175, 0.19962027668952942, 0.030966708436608315, 0.1436246931552887, -0.21247147023677826, 0.1080198884010315, 0.02416945993900299, 0.06602545082569122, -0.413293719291687, 0.258748859167099, -0.014453104697167873, -0.22002233564853668, -0.1026776134967804, 0.15408167243003845, 0.3859541416168213, -0.34680116176605225, 0.020468860864639282, -0.1017046645283699, -0.21351243555545807, 0.2738752067089081, -0.28672537207603455, -0.05902617797255516, 0.0654316172003746, 0.3275730609893799, 0.25089380145072937, 0.2156902253627777, 0.18395817279815674, 0.17460931837558746, 0.09350919723510742, 0.4132477939128876, -0.03079063817858696, -0.12332703173160553, 0.0029667324852198362, -0.09036454558372498, -0.05656089633703232, -0.30132967233657837, 0.3779541850090027, -0.4599745571613312, -0.10072620958089828, 0.23339299857616425, -0.1467258632183075, 0.005664231721311808, 0.033732131123542786, 0.24836429953575134, 0.10704982280731201, -0.2621464729309082, 0.27916207909584045, 0.017606908455491066, 0.021781371906399727, 0.3856351673603058, -0.2298927903175354, 0.1456385850906372, 0.08664967119693756, 0.42799511551856995, 0.19120997190475464, 0.08677171170711517, 0.22853656113147736, 0.13159969449043274, -0.46108412742614746, -0.3208995759487152, -0.10690692067146301, 0.10199175029993057, 0.1377643495798111, 0.2878592908382416, -0.17465543746948242, -0.026994826272130013, 0.12229665368795395, 0.1870105117559433, -0.14917251467704773, -0.029341941699385643, 0.02487516589462757, -0.13401098549365997, 0.06822408735752106, 0.047108255326747894, 0.30334365367889404, 0.22584572434425354, 0.015977801755070686, 0.044641077518463135, -0.0853179469704628, -0.01034301333129406, -0.41374990344047546, 0.011657039634883404, 0.024023350328207016, 0.21102935075759888, 0.11200687289237976, 0.07604470103979111, -0.13820010423660278, -0.033245693892240524, 0.29385697841644287, -0.2629936933517456, -0.1742492914199829, -0.4430278539657593, 0.059456586837768555, -0.005820879712700844, -0.08289095759391785, 0.230892613530159, 0.021758709102869034, -0.34936586022377014, -0.21420831978321075, -0.1783481240272522, 0.2030445635318756, 0.2989426851272583, -0.0071336147375404835, 0.35147884488105774, 0.2581545114517212, -0.0035942327231168747, 0.23585103452205658, 0.19561876356601715, 0.06273454427719116, -0.45853444933891296, 0.15426231920719147, 0.44000306725502014, -0.0585353821516037, 0.07727967947721481, -0.07029365748167038, 0.0784812718629837, 0.2070714235305786, 0.06912847608327866, 0.06716207414865494, -0.38276374340057373, -0.2325223684310913, 0.35732418298721313, 0.5423648953437805, 0.40724581480026245, 0.009469843469560146, -0.11992395669221878, -0.18630734086036682, 0.2812197804450989, -0.423431932926178, -0.3921651542186737, 0.22317716479301453, 0.2112451046705246, 0.04564488306641579, -0.11524758487939835, -0.26262569427490234, 0.11134424805641174, 0.03918910026550293, 0.10051245242357254, -0.06835640221834183, -0.15422244369983673, 0.3816716969013214, 0.34196603298187256, 0.11520474404096603, -0.248460054397583, 0.09961001574993134, -0.0036607254296541214, -0.19121837615966797, 0.5780709981918335, 0.013111012056469917, 0.31486907601356506, 0.0862170159816742, -0.22058995068073273, -0.013476642780005932, -0.2652890086174011, 0.29852157831192017, 0.11329348385334015, 0.049394916743040085, -0.09555695205926895, 0.4409901201725006, -0.03224068507552147, 0.003891852218657732, -0.23988521099090576, -0.3835207223892212, 0.03165460377931595, -0.10211504995822906, -0.19804491102695465, -0.06268967688083649, -0.17793291807174683, 0.08181717991828918, -0.004636696074157953, -0.10522919148206711, -0.04847212880849838, 0.14905807375907898, -0.06979266554117203, 0.2193257361650467, -0.7102015614509583, 0.35685229301452637, -0.015394576825201511, 0.21962790191173553, -0.006895689759403467, 0.027445456013083458, 0.19851267337799072, 0.13520324230194092, 0.07749417424201965, -0.1274237483739853, 0.06324156373739243, -0.08694829046726227, 0.017552901059389114, -0.01817288063466549, -0.04402824118733406, -0.1820732206106186, -0.06733627617359161, -0.2454107105731964, -0.29899415373802185, 0.19106021523475647, 0.4642946422100067, 0.257941335439682, -0.21172159910202026, 0.21024756133556366, 0.1895163655281067, -0.0018318326910957694, -0.04670119285583496, 0.007600108161568642, -0.3009836971759796, -0.3384607136249542, 0.06299804151058197, 0.11697909981012344, -0.027359738945961, -0.39263486862182617, 0.037846047431230545, 0.008233655244112015, -0.0022859221789985895, -0.46609991788864136, 0.190652534365654, 0.036641042679548264, 0.3921414613723755, 0.13660885393619537, 0.08760827034711838, -0.19138385355472565, -0.12887336313724518, -0.6261276006698608, -0.07745063304901123, 0.1408565193414688, -0.027239365503191948, -0.06064930185675621, 0.23845764994621277, 0.05874178186058998, -0.2467811405658722, 0.28996142745018005, -0.4334382116794586, 0.026411909610033035, 0.02390831522643566, -0.3930666744709015, -0.05343015119433403, -0.013798928819596767, -0.03626582399010658, -0.08431702852249146, -0.3480244576931, -0.14173582196235657, -0.10429704934358597, 0.27614304423332214, -0.3093971610069275, 0.3391559422016144, -0.1596834361553192, -0.21434177458286285, -0.12942498922348022, 0.02752583660185337, 0.48605242371559143, 0.04348034784197807, 0.09970365464687347, 0.1253850907087326, 0.02560342475771904, -0.3106209337711334, 0.10070642083883286, 0.15451855957508087, 0.2941522002220154, -0.11882753670215607, -0.010397731326520443, 0.1382458209991455, -0.06621773540973663, 0.1894260197877884, 0.14562833309173584, -0.09207150340080261, 0.15960288047790527, -0.03433007001876831, -0.05577749386429787, -0.18556027114391327, -0.007284427527338266, 0.006871192716062069, 0.1802998036146164, 0.20399022102355957, -0.2509247660636902, 0.0992012694478035, -0.23715899884700775, -0.24451328814029694, -0.12316786497831345, 0.08535350114107132, 0.24743087589740753, -0.19652345776557922, 0.16342605650424957, -0.006512903142720461, 0.3367505967617035, 0.14198456704616547, -0.07453657686710358, 0.3665940761566162, -0.2272612750530243, -0.041563794016838074, -0.10113099962472916, -0.04538671299815178, 0.08844989538192749, -0.4045807421207428, -0.05784080550074577, -0.21537308394908905 ]
https://github.com/huggingface/datasets/issues/5425
Sort on multiple keys with datasets.Dataset.sort()
> I meant typing.Sequence (datasets.Sequence is a feature type). Sorry, I actually meant `typing.Sequence` and not `type.hinting`. However, the issue is still that `dataset.Sequence` is imported in `arrow_dataset.py` so I cannot import and use `typing.Sequence` for the `sort`'s signature without overwriting the `dataset.Sequence` import. The latter is used in the `align_labels_with_mapping` method so it's a necessary import for `arrow_dataset.py`. To import `typing.Sequence` as something else than `Sequence` to avoid overwriting may only be confusing and doesn't seem good practice!? The other solution is to keep `List` type hinting as in the signature I posted in my previous post but this excludes other Sequence types and may cause problems further down the line. Please advise, Thanks for all the clarifications!
### Feature request From discussion on forum: https://discuss.huggingface.co/t/datasets-dataset-sort-does-not-preserve-ordering/29065/1 `sort()` does not preserve ordering, and it does not support sorting on multiple columns, nor a key function. The suggested solution: > ... having something similar to pandas and be able to specify multiple columns for sorting. We’re already using pandas under the hood to do the sorting in datasets. The suggested workaround: > convert your dataset to pandas and use `df.sort_values()` ### Motivation Preserved ordering when sorting is very handy when one needs to sort on multiple columns, A and B, so that e.g. whenever A is equal for two or more rows, B is kept sorted. Having a parameter to do this in 🤗datasets would be cleaner than going through pandas and back, and it wouldn't add much complexity to the library. Alternatives: - the possibility to specify multiple keys to sort by with decreasing priority (suggested solution), - the ability to provide a key function for sorting, so that one can manually specify the sorting criteria. ### Your contribution I'll be happy to contribute by submitting a PR. Will get documented on `CONTRIBUTING.MD`. Would love to get thoughts on this, if anyone has anything to add.
119
Sort on multiple keys with datasets.Dataset.sort()
[ 0.028741464018821716, -0.09899337589740753, -0.2973214089870453, 0.11221349984407425, 0.1764691323041916, 0.08357195556163788, 0.06119823083281517, 0.2558813989162445, -0.13195225596427917, 0.04995827376842499, -0.10002277791500092, 0.22852276265621185, 0.005976022221148014, 0.11916109919548035, 0.1299404352903366, -0.1751485913991928, -0.052675873041152954, 0.07647618651390076, 0.10694260150194168, -0.037278253585100174, -0.10407478362321854, -0.018843917176127434, -0.36189672350883484, 0.022627171128988266, 0.16309456527233124, -0.211319699883461, -0.13150985538959503, 0.06319349259138107, -0.20336928963661194, -0.39403992891311646, -0.023737367242574692, 0.3600752353668213, -0.2311311960220337, 0.2830202877521515, -0.00009829093323787674, -0.027034558355808258, -0.15511251986026764, -0.06828892976045609, -0.14293275773525238, -0.05293061584234238, -0.13685062527656555, 0.1365538090467453, -0.31148025393486023, -0.16597580909729004, -0.26916879415512085, -0.517481803894043, 0.07312311977148056, -0.3936796188354492, 0.21545954048633575, 0.11239194869995117, 0.30136850476264954, 0.21242313086986542, 0.08837921172380447, -0.020500464364886284, 0.15879520773887634, -0.038167804479599, 0.03924916312098503, -0.27118930220603943, 0.14484061300754547, 0.15542326867580414, -0.042367320507764816, 0.17660818994045258, -0.06745560467243195, -0.20266829431056976, 0.27615466713905334, -0.04900844767689705, -0.1744646579027176, 0.07352420687675476, 0.276804655790329, -0.048764731734991074, 0.42820027470588684, -0.3786011040210724, -0.3875385820865631, -0.18187670409679413, 0.1576341986656189, 0.041407711803913116, 0.01363010611385107, -0.11205583065748215, 0.1906524896621704, -0.18286876380443573, 0.0253467820584774, -0.04230644553899765, -0.10334239900112152, 0.33909863233566284, -0.21739134192466736, 0.25068655610084534, -0.14904356002807617, -0.05559879541397095, 0.2212914377450943, -0.31704574823379517, 0.11758691817522049, -0.48928478360176086, 0.07492232322692871, 0.12360358983278275, -0.3871307075023651, -0.23457695543766022, 0.41621190309524536, 0.3631003499031067, 0.20420928299427032, -0.23175935447216034, -0.09831859171390533, 0.03442925214767456, 0.11145657300949097, -0.07862799614667892, 0.4601077437400818, 0.23155617713928223, 0.4143107533454895, 0.2871588170528412, 0.10558782517910004, -0.15301452577114105, -0.08470325917005539, 0.008258804678916931, 0.23843777179718018, -0.4598367214202881, -0.11582072824239731, 0.2984207272529602, -0.0024685747921466827, -0.01222578901797533, -0.07282502204179764, -0.13710127770900726, 0.2499946653842926, -0.11843417584896088, 0.32767945528030396, 0.4415939152240753, 0.15942507982254028, 0.015413908287882805, -0.30153194069862366, 0.05728483200073242, 0.04334966465830803, 0.2917996346950531, -0.3173701763153076, -0.016046281903982162, 0.11875352263450623, -0.18779811263084412, 0.06037387251853943, -0.09712766855955124, -0.16569070518016815, 0.122409388422966, 0.1567566990852356, -0.10008503496646881, 0.08057725429534912, 0.06857022643089294, 0.2257465422153473, 0.29695039987564087, 0.11611581593751907, 0.1641055941581726, -0.025623725727200508, -0.12034722417593002, -0.25645431876182556, 0.205649733543396, -0.3393760025501251, -0.20160476863384247, 0.2391362488269806, 0.2643216848373413, 0.12448668479919434, 0.09156861156225204, -0.2836962938308716, 0.10045425593852997, 0.2931644320487976, -0.2490716278553009, -0.1282299906015396, 0.10369186848402023, -0.1263352930545807, -0.1338959038257599, -0.07697287946939468, -0.01695343852043152, -0.23882731795310974, 0.013437679037451744, -0.2867739200592041, 0.0458216592669487, -0.14717240631580353, -0.022884326055645943, -0.1372058242559433, 0.1682179868221283, 0.08400566130876541, 0.4115127623081207, 0.5246119499206543, -0.25035303831100464, -0.5486193299293518, 0.24931985139846802, -0.12953656911849976, -0.316114604473114, 0.16261045634746552, 0.36588165163993835, 0.21764063835144043, -0.1080687940120697, 0.17386585474014282, 0.09656177461147308, 0.06566561013460159, 0.1413278877735138, 0.05509106442332268, 0.026691755279898643, 0.04763496667146683, 0.09746909886598587, 0.18258927762508392, -0.18801520764827728, 0.18442866206169128, -0.12867653369903564, 0.07147156447172165, -0.17986805737018585, -0.2552776038646698, 0.2932296693325043, -0.07146204262971878, -0.04671154171228409, 0.11469095200300217, -0.1888485997915268, -0.2776067554950714, 0.09598945081233978, 0.21691830456256866, -0.19637557864189148, -0.3188058137893677, -0.1703096330165863, -0.15814805030822754, 0.003167852759361267, -0.2981880307197571, 0.43992531299591064, 0.30934813618659973, 0.04590253904461861, -0.14083395898342133, -0.09301429986953735, -0.10139147192239761, 0.07767325639724731, 0.14301806688308716, -0.13094200193881989, -0.18788938224315643, 0.30042821168899536, -0.25594988465309143, 0.31301772594451904, 0.10518334805965424, -0.07078729569911957, 0.2558874189853668, 0.10056102275848389, 0.12523286044597626, 0.3052782714366913, 0.046064846217632294, -0.17728833854198456, 0.13048811256885529, 0.07967263460159302, -0.02715574949979782, 0.14838431775569916, 0.08697950839996338, 0.1438976377248764, -0.011832283809781075, 0.06474629044532776, -0.5371254086494446, 0.6956678628921509, -0.2035532146692276, 0.19834968447685242, 0.15104900300502777, -0.05159931257367134, -0.04776904359459877, 0.26706406474113464, 0.022406242787837982, -0.23311270773410797, 0.18953894078731537, 0.21901406347751617, -0.024510568007826805, 0.10708460211753845, -0.11982258409261703, 0.41455453634262085, 0.6199867129325867, 0.03352299705147743, 0.27068352699279785, -0.12812234461307526, 0.12096802890300751, 0.12044632434844971, 0.09573175758123398, 0.32039573788642883, -0.00476019037887454, 0.36533504724502563, 0.12256555259227753, -0.2140568345785141, -0.004775006789714098, -0.010725472122430801, -0.040854353457689285, 0.03006882406771183, -0.28911444544792175, 0.3847918212413788, 0.22437109053134918, 0.023196067661046982, -0.4351916015148163, 0.019098928198218346, 0.2587398886680603, -0.002195655135437846, -0.25597551465034485, -0.06115487217903137, -0.23312318325042725, -0.23552662134170532, 0.2014453411102295, -0.028508152812719345, -0.2556595206260681, -0.20508043467998505, 0.2772729992866516, -0.18023738265037537, -0.020554974675178528, 0.058181796222925186, 0.06811882555484772, 0.11395329982042313, 0.29818376898765564, -0.04306061565876007, 0.06895627826452255, -0.1549319475889206, 0.0038211180362850428, 0.1969866007566452, 0.19441509246826172, 0.18841761350631714, 0.4552612602710724, -0.023151539266109467, -0.10380826890468597, -0.0008603439200669527, -0.3883145749568939, -0.16494590044021606, -0.16007906198501587, -0.04555778577923775, 0.10475696623325348, 0.07942239940166473, -0.170744851231575, -0.014722604304552078, 0.07637723535299301, 0.239674910902977, -0.2990134060382843, 0.18565014004707336, 0.07611586898565292, -0.24249188601970673, -0.22554217278957367, -0.31050577759742737, 0.1628037840127945, 0.04459526762366295, 0.02515130117535591, -0.009111699648201466, 0.32996299862861633, -0.2689761519432068, -0.06573230773210526, -0.08190502971410751, -0.09226939082145691, -0.015839165076613426, -0.11080092936754227, 0.0911756157875061, 0.26182058453559875, -0.017259590327739716, -0.11627946048974991, -0.17516663670539856, 0.018687555566430092, -0.37253737449645996, 0.096438929438591, -0.08320402354001999, -0.2570739686489105, -0.11962383985519409, 0.2844480574131012, -0.023050813004374504, 0.31526288390159607, 0.3632940351963043, 0.17984257638454437, -0.15952637791633606, -0.2913755476474762, -0.212080717086792, -0.12867677211761475, 0.03576914593577385, 0.06076393648982048, -0.222672238945961, 0.37091925740242004, 0.4100162088871002, 0.314433217048645, -0.31595489382743835, 0.05251911282539368, 0.09986817091703415, 0.0971875935792923, 0.1581433266401291, -0.026691561564803123, -0.3397607207298279, 0.07663605362176895, 0.26961347460746765, 0.2836642265319824, 0.21160617470741272, 0.1588263064622879, -0.004899116232991219, 0.05002809688448906, 0.023800497874617577, -0.16895371675491333, -0.03600868210196495, -0.10271711647510529, -0.09049990773200989, 0.0025359669234603643, 0.17975661158561707, 0.1987525075674057, -0.4322522282600403, -0.01353919692337513, -0.1523052304983139, -0.09588416665792465, -0.2775111496448517, -0.1532660275697708, -0.4073219299316406, -0.0225144661962986, -0.32482507824897766, 0.05860809236764908, 0.24598075449466705, -0.06660757958889008, 0.12772241234779358, 0.20894786715507507, -0.07537244260311127, -0.4535475969314575, 0.7264634966850281, -0.03479468449950218, 0.2244250476360321, 0.1056964322924614, -0.04653359577059746, -0.2877999544143677, 0.386326402425766, -0.0923352986574173, 0.3816564679145813, -0.3733280599117279, 0.4020630717277527, -0.3640495836734772, -0.11360924690961838, -0.2745121121406555, 0.06633970886468887, -0.0886177271604538, -0.3054408133029938, -0.23281055688858032, -0.1869032084941864, -0.056929413229227066, 0.1902729868888855, 0.04687241092324257, 0.0898398756980896, -0.20126931369304657, -0.1646491438150406, -0.11180843412876129, -0.14261658489704132, -0.042835865169763565, -0.043210916221141815, 0.32821163535118103, 0.306610643863678, -0.0194955226033926, 0.17154859006404877, 0.09807342290878296, 0.05853812396526337, 0.06522303074598312, 0.11859067529439926, -0.12706686556339264, -0.23855140805244446, -0.057969171553850174, -0.1155557632446289, 0.12367766350507736, -0.23189283907413483, 0.055988021194934845, 0.08753781020641327, 0.06897284090518951, 0.28997406363487244, 0.07451390475034714, 0.4161418676376343, 0.04203232750296593, -0.31354185938835144, -0.34835514426231384, 0.5198854207992554, -0.03438209369778633, -0.271411657333374, 0.30008918046951294, 0.5188669562339783, -0.34985294938087463, -0.10039042681455612, 0.12252308428287506, 0.45780670642852783, -0.25626036524772644, 0.15132583677768707, 0.08422946184873581, -0.16238678991794586, 0.0760197639465332, -0.15231524407863617, 0.3884741961956024, -0.3539924621582031, -0.38853025436401367, 0.0028728952165693045, 0.0030920403078198433, -0.07987355440855026, 0.37980255484580994, -0.20288437604904175, 0.19962027668952942, 0.030966708436608315, 0.1436246931552887, -0.21247147023677826, 0.1080198884010315, 0.02416945993900299, 0.06602545082569122, -0.413293719291687, 0.258748859167099, -0.014453104697167873, -0.22002233564853668, -0.1026776134967804, 0.15408167243003845, 0.3859541416168213, -0.34680116176605225, 0.020468860864639282, -0.1017046645283699, -0.21351243555545807, 0.2738752067089081, -0.28672537207603455, -0.05902617797255516, 0.0654316172003746, 0.3275730609893799, 0.25089380145072937, 0.2156902253627777, 0.18395817279815674, 0.17460931837558746, 0.09350919723510742, 0.4132477939128876, -0.03079063817858696, -0.12332703173160553, 0.0029667324852198362, -0.09036454558372498, -0.05656089633703232, -0.30132967233657837, 0.3779541850090027, -0.4599745571613312, -0.10072620958089828, 0.23339299857616425, -0.1467258632183075, 0.005664231721311808, 0.033732131123542786, 0.24836429953575134, 0.10704982280731201, -0.2621464729309082, 0.27916207909584045, 0.017606908455491066, 0.021781371906399727, 0.3856351673603058, -0.2298927903175354, 0.1456385850906372, 0.08664967119693756, 0.42799511551856995, 0.19120997190475464, 0.08677171170711517, 0.22853656113147736, 0.13159969449043274, -0.46108412742614746, -0.3208995759487152, -0.10690692067146301, 0.10199175029993057, 0.1377643495798111, 0.2878592908382416, -0.17465543746948242, -0.026994826272130013, 0.12229665368795395, 0.1870105117559433, -0.14917251467704773, -0.029341941699385643, 0.02487516589462757, -0.13401098549365997, 0.06822408735752106, 0.047108255326747894, 0.30334365367889404, 0.22584572434425354, 0.015977801755070686, 0.044641077518463135, -0.0853179469704628, -0.01034301333129406, -0.41374990344047546, 0.011657039634883404, 0.024023350328207016, 0.21102935075759888, 0.11200687289237976, 0.07604470103979111, -0.13820010423660278, -0.033245693892240524, 0.29385697841644287, -0.2629936933517456, -0.1742492914199829, -0.4430278539657593, 0.059456586837768555, -0.005820879712700844, -0.08289095759391785, 0.230892613530159, 0.021758709102869034, -0.34936586022377014, -0.21420831978321075, -0.1783481240272522, 0.2030445635318756, 0.2989426851272583, -0.0071336147375404835, 0.35147884488105774, 0.2581545114517212, -0.0035942327231168747, 0.23585103452205658, 0.19561876356601715, 0.06273454427719116, -0.45853444933891296, 0.15426231920719147, 0.44000306725502014, -0.0585353821516037, 0.07727967947721481, -0.07029365748167038, 0.0784812718629837, 0.2070714235305786, 0.06912847608327866, 0.06716207414865494, -0.38276374340057373, -0.2325223684310913, 0.35732418298721313, 0.5423648953437805, 0.40724581480026245, 0.009469843469560146, -0.11992395669221878, -0.18630734086036682, 0.2812197804450989, -0.423431932926178, -0.3921651542186737, 0.22317716479301453, 0.2112451046705246, 0.04564488306641579, -0.11524758487939835, -0.26262569427490234, 0.11134424805641174, 0.03918910026550293, 0.10051245242357254, -0.06835640221834183, -0.15422244369983673, 0.3816716969013214, 0.34196603298187256, 0.11520474404096603, -0.248460054397583, 0.09961001574993134, -0.0036607254296541214, -0.19121837615966797, 0.5780709981918335, 0.013111012056469917, 0.31486907601356506, 0.0862170159816742, -0.22058995068073273, -0.013476642780005932, -0.2652890086174011, 0.29852157831192017, 0.11329348385334015, 0.049394916743040085, -0.09555695205926895, 0.4409901201725006, -0.03224068507552147, 0.003891852218657732, -0.23988521099090576, -0.3835207223892212, 0.03165460377931595, -0.10211504995822906, -0.19804491102695465, -0.06268967688083649, -0.17793291807174683, 0.08181717991828918, -0.004636696074157953, -0.10522919148206711, -0.04847212880849838, 0.14905807375907898, -0.06979266554117203, 0.2193257361650467, -0.7102015614509583, 0.35685229301452637, -0.015394576825201511, 0.21962790191173553, -0.006895689759403467, 0.027445456013083458, 0.19851267337799072, 0.13520324230194092, 0.07749417424201965, -0.1274237483739853, 0.06324156373739243, -0.08694829046726227, 0.017552901059389114, -0.01817288063466549, -0.04402824118733406, -0.1820732206106186, -0.06733627617359161, -0.2454107105731964, -0.29899415373802185, 0.19106021523475647, 0.4642946422100067, 0.257941335439682, -0.21172159910202026, 0.21024756133556366, 0.1895163655281067, -0.0018318326910957694, -0.04670119285583496, 0.007600108161568642, -0.3009836971759796, -0.3384607136249542, 0.06299804151058197, 0.11697909981012344, -0.027359738945961, -0.39263486862182617, 0.037846047431230545, 0.008233655244112015, -0.0022859221789985895, -0.46609991788864136, 0.190652534365654, 0.036641042679548264, 0.3921414613723755, 0.13660885393619537, 0.08760827034711838, -0.19138385355472565, -0.12887336313724518, -0.6261276006698608, -0.07745063304901123, 0.1408565193414688, -0.027239365503191948, -0.06064930185675621, 0.23845764994621277, 0.05874178186058998, -0.2467811405658722, 0.28996142745018005, -0.4334382116794586, 0.026411909610033035, 0.02390831522643566, -0.3930666744709015, -0.05343015119433403, -0.013798928819596767, -0.03626582399010658, -0.08431702852249146, -0.3480244576931, -0.14173582196235657, -0.10429704934358597, 0.27614304423332214, -0.3093971610069275, 0.3391559422016144, -0.1596834361553192, -0.21434177458286285, -0.12942498922348022, 0.02752583660185337, 0.48605242371559143, 0.04348034784197807, 0.09970365464687347, 0.1253850907087326, 0.02560342475771904, -0.3106209337711334, 0.10070642083883286, 0.15451855957508087, 0.2941522002220154, -0.11882753670215607, -0.010397731326520443, 0.1382458209991455, -0.06621773540973663, 0.1894260197877884, 0.14562833309173584, -0.09207150340080261, 0.15960288047790527, -0.03433007001876831, -0.05577749386429787, -0.18556027114391327, -0.007284427527338266, 0.006871192716062069, 0.1802998036146164, 0.20399022102355957, -0.2509247660636902, 0.0992012694478035, -0.23715899884700775, -0.24451328814029694, -0.12316786497831345, 0.08535350114107132, 0.24743087589740753, -0.19652345776557922, 0.16342605650424957, -0.006512903142720461, 0.3367505967617035, 0.14198456704616547, -0.07453657686710358, 0.3665940761566162, -0.2272612750530243, -0.041563794016838074, -0.10113099962472916, -0.04538671299815178, 0.08844989538192749, -0.4045807421207428, -0.05784080550074577, -0.21537308394908905 ]
End of preview. Expand in Data Studio

Dataset Card for "dataset-github-issues-embeddings"

More Information needed

Downloads last month
5

Space using ginnigarg/dataset-github-issues-embeddings 1