Is there a PowerShell equivalent of `paste` (i.e., horizontal file concatenation)? [duplicate]

A few months ago, I submitted a proposal for including a Join-Object cmdlet to the standard PowerShell equipment #14994. Besides complexer joins based on a related property, the idea is to also be able to do a side-by-side join (by omiting the -On parameter). Taken this Paste command in Linux as an example: $State=”Arunachal Pradesh”, … Read more

Transpose mysql query rows into columns

You can do it with a crosstab like this – SELECT `year`, `month`, SUM(IF(`transporttype` = ‘inbound’, 1, 0)) AS `inbound`, SUM(IF(`transporttype` = ‘LocalPMB’, 1, 0)) AS `LocalPMB`, SUM(IF(`transporttype` = ‘Long Distance’, 1, 0)) AS `Long Distance`, SUM(IF(`transporttype` = ‘shuttle’, 1, 0)) AS `shuttle`, SUM(IF(`transporttype` = ‘export’, 1, 0)) AS `export`, SUM(IF(`transporttype` = ‘Extrusions-LongDistance’, 1, 0)) … Read more

Is there a safe way in Scala to transpose a List of unequal-length Lists?

How about this: scala> def transpose[A](xs: List[List[A]]): List[List[A]] = xs.filter(_.nonEmpty) match { | case Nil => Nil | case ys: List[List[A]] => ys.map{ _.head }::transpose(ys.map{ _.tail }) | } warning: there were unchecked warnings; re-run with -unchecked for details transpose: [A](xs: List[List[A]])List[List[A]] scala> val ls = List(List(1, 2, 3), List(4, 5), List(6, 7, 8)) ls: … Read more

Use a dope vector to access arbitrary axial slices of a multidimensional array?

Definition General array slicing can be implemented (whether or not built into the language) by referencing every array through a dope vector or descriptor — a record that contains the address of the first array element, and then the range of each index and the corresponding coefficient in the indexing formula. This technique also allows … Read more

Transpose the data in a column every nth rows in PANDAS

If no data are missing, you can use numpy.reshape: print (np.reshape(df.values,(2,5))) [[‘Andrew’ ‘School of Music’ ‘Music: Sound of the wind’ ‘Dr. Seuss’ ‘Dr.Sass’] [‘Michelle’ ‘School of Theatrics’ ‘Music: Voice’ ‘Dr. A’ ‘Dr. B’]] print (pd.DataFrame(np.reshape(df.values,(2,5)), columns=[‘Name’,’School’,’Music’,’Mentor1′,’Mentor2′])) Name School Music Mentor1 Mentor2 0 Andrew School of Music Music: Sound of the wind Dr. Seuss Dr.Sass 1 … Read more