multiple-columns

Batch - combining 3 columns of x, y, z values into 1 column without using MatLab

。_饼干妹妹 提交于 2019-12-23 03:01:58
问题 I have about 150 files containing 3 columns of x, y, z values and no header. x1 y1 z1 x2 y2 z2 x3 y3 z3 ... xn yn zn For our compress sensing algorithm, I need to have these values in one column only x1 y1 z1 x2 y2 z2 . . . xn yn zn How could I perform this batch operation for 150 files, without using MatLab? From my previous question, I believe this could be done by using sed. But batch processing 150 files effectively is beyond my ability. I am running on Win7 with cygwin installed. Any

Averaging down a column of averaged data

妖精的绣舞 提交于 2019-12-23 00:07:31
问题 I am writing a code in python for a project that has to accomplish a few things; 1) read in data from an xls file column by column 2) average each row of the columns in groups of three 3) then average the resulting columns I have accomplished 1 and 2 but can't quite seem to get 3, I think a lot of the trouble I'm having stems from the fact that I am using float however I need the numbers to 6 decimal places. Any help and patience is appreciated, I'm very new to python v = open("Pt_2_Test_Data

creating a new variable using two columns when they satisfy certain conditions using R

随声附和 提交于 2019-12-22 10:37:21
问题 I am providing this example data to get my question across. aid=c(1,2,3,4,5,6,7,8,9,10) foson=c(0,1,2,0,6,9,0,0,3,0) fosof=c(0,0,2,3,0,0,0,5,0,0) data=data.frame(aid,foson,fosof) Now, I need to create a new variable (column) named data$hist with the following conditions: if foson==0 and fosof==0, then hist = 0; if foson >=1 and fosof==0, then hist = 1; if foson==0 and fosof>=1, then hist = 2; and if foson>=1 and fosof>=1, then hist = 3 I tried to use the "ifelse" function but fell short. I

Convert datetime string to new columns of Day, Month, Year in pandas data frame

泪湿孤枕 提交于 2019-12-22 09:19:16
问题 I am new to python and have a pretty simple (hopefully straightforward!) question. Say that I have a data frame with 3 columns: time (which is in the format YYYY-MM-DDTHH:MM:SSZ), device_id, and rain but I need the first column, "time", to become three columns of "day", "month", and "year" with values from the timestamp. So the original data frame looks something like this: time device_id rain 2016-12-27T00:00:00Z 9b839362-b06d-4217-96f5-f261c1ada8d6 NaN 2016-12-28T00:00:00Z 9b839362-b06d

Assigning results of strsplit to multiple columns of data frame

烂漫一生 提交于 2019-12-22 08:48:14
问题 I am trying to split a character vector into three different vectors, inside a data frame. My data is something like: > df <- data.frame(filename = c("Author1 (2010) Title of paper", "Author2 et al (2009) Title of paper", "Author3 & Author4 (2004) Title of paper"), stringsAsFactors = FALSE) And I would like to split those 3 informations ( authors , year , title ) into three different columns, so that it would be: > df filename author year title 1 Author1 (2010) Title1 Author1 2010 Title1 2

pandas failing with variable columns

拈花ヽ惹草 提交于 2019-12-21 22:04:20
问题 my file is this 4 7 a a s g 6 8 0 d g 6 2 1 f 7 9 f g 3 1 2 4 6 8 9 0 I was using pandas to save it in form of pandas object. But I am getting the following error pandas.parser.CParserError: Error tokenizing data. C error: Expected 6 fields in line 3, saw 8 The code I used was file = pd.read_csv("a.txt",dtype = None,delimiter = " ") Can anyone suggest an idea to include the file as such ? 回答1: Here's one way. In [50]: !type temp.csv 4,7,a,a s,g,6,8,0,d g,6,2,1,f,7,9 f,g,3 1,2,4,6,8,9,0 Read

Dynamic floating columns if height exceeded

泪湿孤枕 提交于 2019-12-21 21:28:04
问题 I've got a questing concerning a dynamic floating layout of <li> 's in a <ul> -Container: The grey container <ul> has a fixed height of 150px and all <li> 's in it should use the maximum height of 150px and THEN arrange in the next column (See Element 7, 8) I'm quite shure the solution is obvious, but I'm stuck in trying several float-combinations with width and height. Anyone suggestions or a solution? 回答1: You can use CSS3 columns: "CSS Multi-column Layout Module": HTML <ul> <li>1</li> <li

Unpivot table with multiple columns and dynamic column names

丶灬走出姿态 提交于 2019-12-21 20:24:17
问题 I am trying to unpivot a table with multiple rows and columns. Each row needs to be extratced to 2 rows with specific columns and the column names need to be renamed and a new column needs to added based on the columns selected! I am including before and after sample data and a script to setup the data. CREATE TABLE #tmpProducts ( ProductId INT, ProductName nVARCHAR(100), B2B_GrossRevenue DECIMAL(10,2), B2B_DirectCost DECIMAL(10,2), B2B_NetRevenue DECIMAL(10,2), B2C_GrossRevenue DECIMAL(10,2)

Pivot rows into columns Firebird 2.5

最后都变了- 提交于 2019-12-21 17:39:46
问题 The sequence: table1 ===== id - Description ---------------- |1 |Proj-x |2 |Settlers |3 |Bank |4 |Newiest table2 ===== id table1Id value alternate-value --------------------------------- |1| 1 |12 |null |1| 4 |6 | null |1| null |22 |Desktop |2| 2 |7 |null |2| 3 |11 |null |2| null |2 |Camby Jere |3| 1 |8 |null |3| 4 |6 |null |3| null |7 |Camby Jere The select instruction must return |table1.id|Proj-x|Settlers|Bank |Newiest|Desktop|Camby Jere ----------------------------------------------------

parsing a dictionary in a pandas dataframe cell into new row cells (new columns)

。_饼干妹妹 提交于 2019-12-21 17:00:09
问题 I have a Pandas Dataframe that contains one column containing cells containing a dictionary of key:value pairs, like this: {"name":"Test Thorton","company":"Test Group","address":"10850 Test #325\r\n","city":"Test City","state_province":"CA","postal_code":"95670","country":"USA","email_address":"test@testtest.com","phone_number":"999-888-3333","equipment_description":"I'm a big red truck\r\n\r\nRSN# 0000","response_desired":"week","response_method":"email"} I'm trying to parse the dictionary,