multiple-columns

How to get ordered, defined or all columns except or after or before a given column

我的梦境 提交于 2019-12-25 10:50:17
问题 In BASH I run the following one liner to get an individual column/field after splitting on a given character (one can use AWK as well if they want to split on more than one char i.e. on a word in any order, ok). #This will give me first column i.e. 'lori' i.e. first column/field/value after splitting the line / string on a character '-' here echo "lori-chuck-shenzi" | cut -d'-' -f1 # This will give me 'chuck' echo "lori-chuck-shenzi" | cut -d'-' -f2 # This will give me 'shenzi' echo "lori

Extracting column ranges and reconstituting matrix via awk

我与影子孤独终老i 提交于 2019-12-25 08:57:26
问题 Assume a text file ( file1 ) that contains m lines of alphabetic strings S ( S_1 , S_2 , ..., S_m ). Each S is preceded by a short alphanumeric string that acts as a barcode (here: foo1 , bar7 , baz3 ). The alphabetic strings S are all identical in length. Each S and its preceding barcode is separated by a whitespace. $ cat file1 foo1 abcdefghijklmnopqrstuvwxyz bar7 abcdefghijklmnopqrstuvwxyz baz3 abcdefghijklmnopqrstuvwxyz Assume a second file ( file2 ) that contains n specifications of

Modify text column based on the column before it

╄→尐↘猪︶ㄣ 提交于 2019-12-25 07:43:34
问题 I have a file whose first 28 rows are just words. Starting from 29th to 100th row, I have position information of atoms for A, B and C, and their 3d coordinates. Now what I would like to do is to change Z (the 4th column) in a way related to Y (the 3rd column) for Row 29-100: Z = Z + sin(Y/10*Pi). Is that possible just in the terminal? Thanks. A 0.016333 0.003203 0.472723 A 0.016333 0.035228 0.472723 B 0.016333 0.067253 0.472723 B 0.016333 0.099278 0.472723 C 0.016333 0.131303 0.472723 C 0

how can I display the first post in a single column and others in 2 columns? wordpress

梦想的初衷 提交于 2019-12-25 05:23:28
问题 I currently have all the posts displayed in one column: 1 2 3 ... I'd like to achieve something similar: 1 23 4 56 ... does anyone have any ideas of how I could do this? is it possible? thank you so much in advance :) right now I have: <?php if( $wp_query->current_post <= 0 ) : ?> code for the first one column post <?php else : ?> the rest of the posts styled in columns <?php endif; ?> 回答1: The solution I found for this problem was using the $wp_query->current_post of a default loop, in a

Table with rows and columns in Objective-C for iOS

跟風遠走 提交于 2019-12-25 03:54:42
问题 How can I implement a table with rows and columns in Objective-C? I need to show a timetable: columns for week's day and rows for hours. I have no idea. TableView makes rows. Would UICollectionView be right for this? 回答1: You can use UITableView . But instead of using the default UITableViewCell , you have to create a custom cell with 7 labels equally spacing horizontally. Then you add 24 rows, each for one hour. And I think that's all you need, simple and straight forward. 回答2: That depends

Change the value of the key, then delete the key on comma delimited CSV using regex

ε祈祈猫儿з 提交于 2019-12-25 03:54:32
问题 I got this pattern: ...,432,3333333,607,5500,617,5000,... ...,66,88,432,22625,607,45330,617,5000,... ...,432,3600000,607,87,617,5000,... From a multi columned csv file delimited by comma, The data should be, the first column should be the key, the second column should be the value, so what I was asked to do is to set all specific keys to zero, and delete the key I need to delete all "607" keys to the csv hence, the above should result to: ...,432,3333333,0,0,617,5000,... ...,66,88,432,22625,0

Python - comparing columns in 2 files and returning merged output

核能气质少年 提交于 2019-12-25 03:12:18
问题 I have a seemingly simple problem but have been stuck on it for too long now. I would like to compare two files (format shown below) > file1 20 246057 0.28 68363 0 A 20 246058 0.28 68396 T C 20 246059 0.28 76700 A G 20 246060 0.28 76771 T C 20 246061 0.28 76915 0 A > file2 112879285 R 68303 20 200068921 M 68319 20 200257910 K 68336 20 200192457 W 68363 20 138777928 Y 68396 20 I want to compare file1 column 0 and 3 with file2 column 2 and 3 and if they match, I want to output the rest of the

Code for a multicolumn legend in Matlab

旧时模样 提交于 2019-12-25 01:49:38
问题 I have designed an application called CLegend, which allows to build a multicolumn legend, whose code is function CLegend(hax,numcol,Ley) %# Inputs % hax : handle of the axes object to which belongs the legend % numcol: number of columns for the legend % Ley: text strings (labels) for the legend set(hax,'Units','normalized','Position',[0.1 0.1 0.8 0.8]); set(hax,'Units','characters'); posAx = get(hax,'Position'); insAx = get(hax,'TightInset'); [legend_h,object_h] = legend(hax,Ley,'Units',

Is it possible from dataframe transform to Matrix?

纵饮孤独 提交于 2019-12-25 00:15:32
问题 I am newbie in python, I have a huge dataframe : Person OD A BS1 A BS2 B BS4 B BS8 C BS5 C BS1 D BS9 D BS7 E BS2 E BS7 F BS2 F BS1 G BS1 G BS2 is it possible to transform into an origin-destination (OD) matrix in python-pandas? Example from BS1 to BS2 there is 2 person (A and G) then in OD matrix 2 people into BS1-BS2. my expected result: O/D BS1 BS2 BS3 BS4 BS5 BS6 BS7 BS8 BS9 BS1 2 BS2 1 1 BS3 BS4 1 BS5 1 BS6 BS7 BS8 BS9 1 how to do it? thanks a lot 回答1: Following is a solution. places = df

Spotfire - How to group multiple columns under a single column in data table visualization

丶灬走出姿态 提交于 2019-12-24 19:39:01
问题 How to group multiple columns under a single column in data table visualization Please see attached image 回答1: @BULB - You can transform your table by unpivoting and pivoting data to get the desired result. I first un-pivoted the original data table by applying transformation. INSERT > Transformations Then pivoted the unpivot output by applying another transformation. Note: You can apply both the transformations simultaneously. Final Output: 来源: https://stackoverflow.com/questions/46766637