split data numbers into two columns in shell script

I have numbers from 1 to 1000 in file ($y). for i in {1..1000} do echo "$i" >> $y done I want to split numbers into two column in the file(user enters the filename that indicates "$y"). 1 501 . . . . 500 1000 like this. I tried ‘split -l500 $y’ and ‘column -t… Read More split data numbers into two columns in shell script

How to prevent a surplus of the substring used as separator by re.split from being left inside one of the resulting list items after string splitting?

import re input_text = "Creo que ((PERS)los viejos gabinetes) estan en desuso, hay que hacer algo con ellos, ya que ellos son importantes. ellos quedaron en el deposito de ellos. ellos ((PERS)los cojines) son acolchonados, ellos estan sobre el sofá. creo que ellos estan sobre el sofá" pattern = r"\(\(PERS\)\s*los\s*" matches = re.findall(pattern, input_text) result… Read More How to prevent a surplus of the substring used as separator by re.split from being left inside one of the resulting list items after string splitting?

Getting the "ValueError: Columns must be same length as key" when splitting out the date column by "/"

I tried to split the date column into 3 separate columns df[[‘date1’, ‘date2’, ‘date3’]] = df[‘Date’].str.split(‘/’) Here’s the error I’m getting ValueError: Columns must be same length as key It works fine when I just type in df[‘Date’].str.split(‘/’) and I was able to confirm that each list has only 3 elements. I think it might… Read More Getting the "ValueError: Columns must be same length as key" when splitting out the date column by "/"

Create a data frame in R from a string that follows a specific keyword

I have a string as such: "05/05/2005 ANNIVERSARY $367.62 ANNUAL DIVIDEND DECLARED UNDER THE PAIO UP ADDITIONS 20,965 2,203 23,168 | PAID UP ADDITION OPTION. $367.62 PURCHASED PAID UP ADDITIONS OF 2,203 02/15/2006 WITHDRAWAL ($77.50) VALUE OF PAID UP ADDITIONS OF 464 PAID UP ADDITIONS 23,168 (464) 22,704 APPLIED TOWARDS CHECK-O-MATIC PREMIUM DUE 03/05/2006 04/11/2006… Read More Create a data frame in R from a string that follows a specific keyword

If I have comma seperated values in a column , to use it in where condition I have used split_part. But it is taking more time in pgAdmin 4

In PostgreSQL, I have a column receipt_id which will have comma separated values or a single value . Eg: I need to use the values in the third column with another table called Voucher in where condition . I have used split_part. select ap.document_no AS invoice_number, ap.curr_date AS invoice_date,ap.receipt_id,split_part(ap.receipt_id::text, ‘,’::text, 1), split_part(ap.receipt_id::text, ‘,’::text, 2) from… Read More If I have comma seperated values in a column , to use it in where condition I have used split_part. But it is taking more time in pgAdmin 4

How to split file by line count and rename based on column value

I have a file that needs to be split by every 4 lines. Each 4 lines look like: sample_id 145 WORD 2847 42 301M = 2086 -1062 ACAAAAAAGAAAAAATGAGTTACCGTACTGTCTGTGAGTGATGCATACTTTT |||||||||||||| ||| || |||||| |||| |||||||||| |||| TTAAAAAAGAAAAAATCAGTAACAGTACTGGATGTGGGTGATGCATATTTTT so far I use split -l 4 file.txt I want to rename the output files so that it looks… Read More How to split file by line count and rename based on column value

javascript: parse a string and split it between tags and text

I am building a script that takes a string and separates left and right part based on some characthers. However, I am having some difficulties handling edge cases. The script will be of the following format: @tag1@tag2@tag3:lorem ipsum quare id… and I would like to get to get something like: { tags:["tag1", "tag2", "tag3"], text:"lorem… Read More javascript: parse a string and split it between tags and text

read a csv file in 3 columns

I want to read a csv file with 3 columns: "source","target","genre_ids" with python df = pd.read_csv(‘edges1.csv’,encoding="ISO-8859-1", delimiter=’;;’, header=None,skiprows=1, names=columns,engine="python",index_col=False ) data = pd.concat([df.iloc[:,0].str.split(‘,’, expand=True).rename(columns:=[‘source’,’target’,’genre_ids’]), axis==1]) I want to get: source target genre_ids apple green 21 strawberry red 23 son on edge1.csv contains: source,target,genre_ids apple,green,21 strawberry,red,23 and so on when I read the edges1.csv file I… Read More read a csv file in 3 columns