FAQ Database Discussion Community


mathematica transpose does not work when using NumberForm and OutputForm

wolfram-mathematica,transpose
the code is like nwwa = List["#w#"]; nkka = List["#ks#"]; For[j = -4, j <= 4, j++, w = 16*(0.5 + 0.1*j); nwwa = Append[nwwa, w]; //calculate ks nkka = Append[nkka, ks]; ] Export["mathematica1.dat",Transpose[{OutputForm[NumberForm[nwwa, {3, 1}]],OutputForm[NumberForm[nkka, 6]]}], "Table"]; But I got the error: "The first two levels of {{"#w#", 1.6,...

can't get numpy.transpose to operate on what outwardly seems to be an array?

python,arrays,numpy,transpose
The following code takes a list of lists arranged as 3 rows of 14 columns and converts it to an array. However, the application of numpy.flip and numpy.transpose appears to do nothing to the new array, although the shape is recognized...is this somehow not properly formatted as a 3x14 array...

Transposing one column in python pandas with the simplest index possible

python,pandas,transpose
I have the following data (data_current): import pandas as pd import numpy as np data_current=pd.DataFrame({'medicine':['green tea','fried tomatoes','meditation','meditation'],'disease':['acne','hypertension', 'cancer','lupus']}) data_current What I would like to do is to transpose one of the columns, so that instead of having multiple rows with same medicine and different diseases I have one row for...

Transpose a simple Access Table

ms-access,access-vba,transpose
Similar questions to this have been asked on SO, but none that I have been able to apply to my situation. I've created this simply sum query to count the number of values I have for each column in my 2 Tag Core Count query: SELECT Count([CORE_DATA].[TAG NUMBER]) AS [TAG...

Count of matching values in matrix columns

r,matrix,linear-algebra,matrix-multiplication,transpose
I'm not really sure how to word this correctly but I would like to count the number of times there are similarities among the columns. Imagine I have the 3 NFL teams listed below. Zeroes are losses and ones are victories. The rows are the week of the NFL season....

row to column Transposed. issue with the record

c#,transpose
This is my table i get from database: **Month PCode Sales** January 001 2 January 002 1 January 003 5 February 001 6 February 002 4 February 003 2 March 001 8 March 002 10 March 003 7 Result that i want: **Month 001 002 003** January 2 1 5...

Transposing matrix / Trouble understanding how bsxfun works

image,matlab,matrix,transpose,bsxfun
This could be a weird question because Many would be wondering why to use such a complicated function like bsxfun for transposing while you have the .' operator. But, transposing isn't a problem for me. I frame my own questions and try to solve using specific functions so that i...

Transposing rows into columns based on a condition sql

sql,duplicates,transpose
I have a following table (a simplified example, in fact the table contains multiple IDs, with variable numbers of dates, and variable number of events for each date): IDs Date Event 102 1996-10-16 00:00:00 A 102 1996-10-23 00:00:00 A 102 1996-10-23 00:00:00 B 102 1997-01-14 00:00:00 A 103 1997-01-14 00:00:00...

Transposing a data.table with reshape2:::dcast

r,data.table,transpose,reshape2
I am transposing a data.table and have chosen to use reshape2:::dcast, however I am plagued by a strange handling of the data.table... here is a toy data set that replicates the behavior: > library(data.table) > library(reshape2) > DT <- structure(list(STORE = c(32123L, 32469L, 33177L, 33484L, 34772L, 34875L), VOLUME = c(343.87205,...

How to decrypt a vigenere columnar transposition cipher

python,python-2.7,encryption,transpose,vigenere
I am going through old exams, my final is in a few days. I want to decrypt a ciphertext, it was first encrypted by vigenere and then encrypted by columna transposition. How do I decrypt to get original message? message -> rgyqhbmnwaazxcajittuzqyagkx vigenere key -> final columnar transposition key ->...

Transpose Column to Rows using SQL Server

sql,sql-server-2008,row,transpose
Could you help me one case, below I have an original table, like this: MONTH | YEAR | PO1 | PO2 | PO3 +++++++++++++++++++++++++++++++++++++++++ 01 2010 100 20 10 then I want a result is like this: DESCRIPTION | VALUE +++++++++++++++++++++++++++++++++++++++++ PO1 100 PO2 20 PO3 10 How should i...

awk or Perl to modify data

perl,csv,awk,transpose
using the below awk and Perl solutions: I need to understand how to add additional field that don't repeat their output much like "name" in these examples. ie devtwr1 only occurs once in the sample data, If i need to add additional fields that also only occur once, how is...

Singular matrix - python

python,numpy,transpose,inverse,singular
The following code shows a problem of singularity of a matrix, since working in Pycharm I get raise LinAlgError("Singular matrix") numpy.linalg.linalg.LinAlgError: Singular matrix I guess the problem is K but I cannot understand exactly how: from numpy import zeros from numpy.linalg import linalg import math def getA(kappa): matrix = zeros((n,...

Transpose result of sum [duplicate]

python,arrays,numpy,matrix,transpose
This question already has an answer here: Transposing a NumPy array 7 answers I have two matrices. The calculation of the sum over axis=1. Then I want to transpose the obtained result. The result incorporates in expression. You must be elements of the matrix 1 and 2 calculates the...

Why does this code double transpose a vector - is this a noop?

r,matrix,transpose
I have some legacy R code that does: b = t(a) c = t(b) What does this code do? Looks like a noop to me. a is a vector constructed by c(1:20). Edit: bonus points on how to do this better....

awk transpose including empty fields into csv

csv,awk,null,transpose
I'm trying to get a handle on awk but am stumped on how to transpose this data and include the nulls of the first two fields ie repeating the value. ie name and osType only occur once for each host instance. Having a null in the additional lines causes issues......

Transpose in excel doesn't work, it just copies one cell

excel,transpose
I've been researching for quite a while and I cannot find the solution to this problem. I need to switch the values of some rows and columns in excel and I saw that I could use transpose, put the array I need to swap and press CTRL+SHIFT+ENTER. I am doing...

How to print a list of arrays transposed in a csv file

python,python-2.7,csv,transpose
I have a list that contains arrays (type = numpy.ndarray) in the following form: final = [[a, b, c, d],[e, f, g, h],[i, j, k, l]] and i would like to print them transposed in a csv file in the following form: a, e, i b, f, j c, g,...

Turning one row into multiple rows in r

r,multiple-columns,transpose
In R, I have data where each person has multiple session dates, and the scores on some tests, but this is all in one row. I would like to change it so I have multiple rows with the persons info, but only one of the session dates and corresponding test...

How to pivot a dataframe in Pandas?

python,pandas,dataframes,transpose
I have a table in csv format that looks like this. I would like to transpose the table so that the values in the indicator name column are the new columns, Indicator Country Year Value 1 Angola 2005 6 2 Angola 2005 13 3 Angola 2005 10 4 Angola 2005...

Transposing rows to columns (with limitations on what methods I can use)

ruby,transpose
I'm doing a practice problem and the question is to transpose rows to columns in Ruby. I understand while loops are "rookie-esque" in Ruby, but I think they prefer I use basic methods and control flow statements: while, each, map. Obviously, I can't use Array#transpose. They want me to basically...

Printing a Square Matrix and Transposing it with Java

java,matrix,transpose,square
I need to write a program that will take a number n from the user and create an nxn matrix that counts up, then I need to transpose it. I've tried multiple methods of coding, but nothing displays correctly. import java.util.Scanner; public class SquareMatrix { public static void main(String[] args)...

Transpose loop in VBA

excel,excel-vba,transpose
I am attempting to transpose values into new rows on the same sheet. Can someone help me with the proper vba code to be the output I am looking for? Given: Col1 Col2 Col3 Col4 Title1 A B C Title2 D E Title3 F title4 G H Wanted: Col1 Col2...

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

c,multidimensional-array,slice,matrix-multiplication,transpose
I'm building a suite of functions to work with a multidimensional-array data structure and I want to be able to define arbitrary slices of the arrays so I can implement a generalized inner product of two arbitrary matrices (aka Tensors or n-d arrays). An APL paper I read (I honestly...

How to transpose a matrix in C? - error

c,matrix,transpose
I am trying to write a function to transpose matrices. paramters of that function: the matrix to transpose the output matrix which is empty. The problem is I am able to transpose some matrices but some other fail like the one i am giving in my example. WHy? how could...

how to access first column after matrix transposed in R

r,transpose
I transposed my data and the original variable names are now in the first column with heading row.names I need to access this column for my analysis but I cannot. Sample of data below: row.names CountryData YR1990 YR1991 YR1992 1 3 AFG 1200 1160 1097 2 4 AGO 320 417...

SAS tranpose long data that has multiple variables and values per group id?

sas,transpose
I have data that is set up like this: Pers Year Month Variable Value AAA 2001 01 Var1 100 AAA 2001 01 Var2 200 AAA 2001 06 Var1 110 AAA 2001 06 Var2 210 AAA 2002 01 Var1 120 AAA 2002 01 Var2 . BBB 2001 01 Var1 100 BBB...

transpose table with jquery or php

jquery,table,transpose
I have a table with this structure, in a PHP page, showed with an echo: <table id="transpose"> <thead> <tr> <th>Event</th> <th>Monday</th> <th>Tuesday</th> <th>Wednesday</th> <th>Thursday</th> <th>Friday</th> <th>Saturday</th> <th>Sunday</th> </tr> </thead> <tbody> <tr> <td>One</td> <td>text11</td> <td>text12</td> <td>text13</td>...

Reorganisation of data frame in r

r,data.frame,transpose
I have this data frame: > data Date Treatment Plate.1 Plate.2 Plate.3 Plate.4 Plate.5 Plate.6 Plate.7 Plate.8 1 2014-10-15 2 1 0 2 5 2 0 11 6 2 2014-11-12 2 3 2 3 0 0 3 2 1 3 2014-12-11 2 1 0 1 1 0 1 1 0...

Anyone can explain this Java code for transposing a matrix?

java,for-loop,multidimensional-array,transpose
I have in front of me a java code but I do not understand what happen in the toString method and the transpose method . I mean what happen in the for loop ? I will be appreciating if anyone can help me with this. this is the other method...

Set Column Names to Indices in a Dataframe

r,data.frame,transpose
I have a dataframe d with 2901 rows. head(d) index V1 V2 V3 V4 V5 V6 1 1 0.0061810090 0.0064328712 0.0061484017 0.0061779441 0.0065441666 0.0059717158 2 2 0.0006206956 0.0006461670 0.0006193262 0.0006194541 0.0006557183 0.0006260470 3 3 0.0009515612 0.0009837086 0.0009368350 0.0009451564 0.0010080150 0.0009061030 4 4 0.0018297131 0.0019052822 0.0017963541 0.0018318636 0.0019390136 0.0017270329 5 5...