Questions tagged [split]

Use this tag for questions about separating an item (e.g. a string) into parts, often by a delimiter or regular expression.

2
votes
1answer
29 views

Split character vector by element in R?

Given a vector: c("kuku", "pupu", "lilu","","ff","rrrr", "", "rrr") How can I split it by ""? To get 3 vectors: c("kuku", "pupu", "lilu") c("ff","rrrr") c("rrr")
0
votes
1answer
27 views

how split function Kotlin working with multiple split parameter

I am new to Kotlin . I want to know how the split function is working .Please see the below example. Example 1: var str ="Kotlin TutorialsEPTutorialaSEpKartSEpExamples" var delimiter1 ="SEP" var ...
0
votes
2answers
38 views

Is there a way to split every string in an array and retrieve the 5th bit each time, adding to a total?

Hi sorry guys I'm pretty new to C# and programming in general. I have a text file that I'm reading from which contains 10 lines (all but the first of which are relevant). I want to split each line (...
0
votes
0answers
15 views

trying to split csv keep getting 'DataFrame' object has no attribute 'split' error

I'm trying to build a dict for my image classifier, however when i keep trying to each line of my csv I'm getting a "Dataframe has no attribute split" error naimg_dict = {} f = pd.read_csv(io....
0
votes
1answer
40 views

Efficient way of splitting large datasets in R

I'm using the function sample.split(data, SplitRatio) to split a dataset of 1Million x 6 elements. It is extremely slow. Is there a faster way to do this in R?
0
votes
2answers
27 views

World Loader wont load world1.txt as an String [duplicate]

I have a problem with my Java Game. When i want to export it, it wont load the World. I'll get an "Thread - 0" Exception. This is my function: private void loadWorld(String path){ String file ...
-2
votes
0answers
31 views

how to find numbers in string text and show them on a chart in C#

so i am reading some data from analog input of a device and i am trying to take the hexadecimal numbers inside this string data and show it on a chart my data is like this: Channel 5to9: 3F 04 1F ...
0
votes
1answer
18 views

How to split a real-time stdout stream into several files?

I have a python script which is continuously writing a text stream to stdout. Something like this (genstream.py): while 1: print (int(time.time())) time.sleep(1) I want a bash script ...
0
votes
1answer
31 views

Escape single quotes from comma separated string in Oracle

I am trying to escape single quotes from the comma separated string in Oracle SQL Developer, below is my Select query: SELECT (CASE WHEN PS.SUPPLIER_NO IS NULL THEN 'FALSE' ELSE 'TRUE' END) AS "Check"...
-2
votes
1answer
23 views

When will following method return 2

I am curious to find out under what circumstances following method will return 2 instead of 1. private int splitString(String strToSplit) { int num = strToSplit.split("[\\W_]+").length; ...
-1
votes
0answers
23 views

how to separate a sign from a number [on hold]

I wanted to separate plus or minus sign from my number, how can I? I could use Split() method but, it returns String array and I need only String because my number has only either plus or minus though ...
2
votes
1answer
20 views

Split data.frame by column with non-sequential values handled as separate groups

Hi I'm trying to split my data.frame in R (into a list of data.frames) based on a column but so that if the values change in that column and then return they are treated as separate groups and split ...
-4
votes
0answers
22 views

How to remove " char from string [duplicate]

My String: "departmentNumber":"1","departmentName":"food" How can I remove the all " from this string?
0
votes
1answer
14 views

Difference between splitByWholeSeparator, splitPreserveAllTokens, and splitByWholeSeparatorPreserveAllTokens

In the org.apache.commons.lang3.StringUtils class, what is the difference between splitByWholeSeparator(String, String), splitPreserveAllTokens(String, String) and ...
0
votes
0answers
29 views

python string split only by `/` but not `//` [duplicate]

For example, I have a string as: str ='s3://files.production/object/Image/110/image.jpg' and I would like to split it into: 's3://files.production' and 'object/Image/110/image.jpg'. I am ...
0
votes
2answers
30 views

How can we split a string by sentence as a delimiter (two words with space between)?

I need to split a string using a substring(two words with space in between). String str = hello hi how are you? I tried: String[] strs = str.split("hi how"); required output: ["hello", "are you?"]...
-1
votes
1answer
42 views

This overload of the method 'System.String.Split' is currently not supported

I'm using Split in an expression in .NET. I get next error: System.NotSupportedException: Could not parse expression 'e.Languages.Split(,, None)': This overload of the method 'System.String.Split' is ...
1
vote
4answers
53 views

JavaScript String split with multiple delimiters while keeping the delimiters

I want to split a string in JavaScript using multiple delimiters while still keeping the delimiters. I tried it with this RegEx but I get matches I'm not interested in. "id:123 name:test pumpe desc:...
0
votes
0answers
23 views

Split php file with multiple classes into class files with namespaces

Have a large file with 130k lines ~2k classes in it each encapsulated in a if(!class_exists()){}. Objective is 2k individual class files with namespaces (currently none) from this data. Will use a ...
1
vote
2answers
38 views

How would I create a function to separate and average rows of this data

I'm new to R and have a large data frame with which I'd like to separate the data by a single letter in the column name, and then append a column at the end containing the average of the row. The data ...
-1
votes
0answers
76 views

How to Split in Split to List in c# [duplicate]

How to Split in Split to List in c# Do not repeat the foreach string data ="A,B,C_D,E,F_G,H,I_K,L,M"; The string above is converted to the following List List<List<string>> DataList = ...
0
votes
1answer
24 views

Split column(s) into a dataset in R

I am new to R and I'm trying to separate the data I got into a more manageable dataset. So far, the dataset looks like this mo yr conc. 1 2009 0.6 2 2009 0.8 4 2009 0.3 1 2010 0.5 2 2010 0.6 ...
0
votes
2answers
49 views

I need to append a list into another list (specific issue)

This is my code: files = open('clean.txt').readlines() print files finallist = [] for items in files: new = items.split() new.append(finallist) And since the file of text is too huge, here is an ...
-1
votes
1answer
30 views

Show the URL parameter in a title

My URL www.exemple.com/?cl=client1, www.exemple.com/?cl=client2, www.exemple.com/?cl=client3, I want to put the URL parameter in the body of the site, presenting the parameter as follows: "client1", "...
0
votes
1answer
21 views

Is it possible to seperate a table into two tables in PowerBI?

In PowerBI I am currently bringing in a query which essentially has two mergekeys and values. It has a "development" column which is associated with a "month+year" column. However, it also has a ...
-1
votes
0answers
27 views

How to split and reconstruct TCP packets (segmentation) [Java / Lua]

I have a Java server, with Lua clients that connect to it. I was sending basic data until now I was using \n to read the data line by line. But I need to send and read compressed data so I used this :...
-1
votes
2answers
51 views

Python to extract a paragraph from a text file: Split string with exact match of multiple nested delimiters

I am reading hundreds of pdf files to extract the abstract. My strategy is: (1) split after the delimiter abstract (2) read abstract (3) stop when blank line. Here is the code that can do this: ...
0
votes
3answers
53 views

Python - Splitting List To Get Minimum & Maximum

I have a list with 2 elements each, the first element is the timestamp and the second is a cost, it's a list of 10, what i want to do is simply sort by minimum and maximum and display it's timestamp ...
2
votes
1answer
30 views

hwo to split dataframe into equal number of subset in python

I have a dataframe import pandas as pd d = {'user': [1, 1, 2,2,2,2 ,2,2,2,2], 'friends': [1,2,1,5,4,6,7,20,9,7]} df = pd.DataFrame(data=d) I try to split the df into several n pieces in a loop. For ...
0
votes
3answers
29 views

Separating a string into a 2d array using two different splits

I'm trying to input values into a CSV using a 2d array. I have a string which is separated by ',' to separate the values and ';' to separate each row. string below; text = 536924636,www.microsoft....
-1
votes
0answers
21 views

Unable to split column on comma [closed]

The dataset is the dictionary which I have converted in the pandas' data frame df=pd.DataFrame(dataset.items(), columns=['number', 'text']) The output looks like: number text 14233229 ...
1
vote
1answer
25 views

How to split dataframe depending on the values of multiple columns

I am using Python. I want to split my dataframe depending on the values of two columns. Every time the value pair changes, I want to split my dataframe at this position. Example: df = pd.DataFrame({'...
-1
votes
0answers
21 views

How to split many audio files to 30 seconds chunks?

I have some speech audio files that I want to split into 30 sec chunks, here is the code # Split Audios to 30 sec from pydub import AudioSegment from pydub.utils import make_chunks myaudio = ...
2
votes
0answers
29 views

How would I be able to split an audio file into multiple wav files using timpooints from an array or csv?

I made the following Python code that allows me to segment an audiofile (.wav) into smaller a segment by using timepoints from an array. However, I want to create multiple segments from the same audio ...
0
votes
0answers
24 views

PostgreSQL - COPY TO PROGAM with (Linux) split

I am trying to export files out of Postgres with COPY...TO PROGRAM with the split command. For purposes of the split, I am using an AWS Ubuntu 18.04 instance. I want to split the files by size (2GB),...
0
votes
0answers
29 views

How to split a matrix based on how close the values are?

Suppose I have a matrix A. A= [1 2 3 6 7 8]; I would like to split this matrix into sub-matrices based on how relatively close the numbers are. For example, the above matrix must be split into B= [...
1
vote
1answer
66 views

Splitting large files in half

tl;dr: I need a way of splitting 5 GB / ~11m row files in ~half (or thirds) while keeping track of exactly every file I create and of course not breaking any lines, so I can process both files at once ...
0
votes
1answer
17 views

Given two audio files, one of which is a snippet of the other, is there a python way to find when the snippet is replayed in the original file?

I have recorded some music and uploaded to instagram, which imposed a minute-long duration per clip. I've lost the original files and have these minute-long clips compiled such that song__AA0, ...
1
vote
1answer
40 views

Split string into cell array by positions

I have a file with strings of a known length, but no separator. % What should be the result vals = arrayfun(@(x) ['Foobar ', num2str(x)], 1:100000, 'UniformOutput', false); % what the file looks ...
0
votes
2answers
50 views

How do I replace all blank lines with “@”?

Assuming I have a list: List<Strings> lines = new ArrayList<String>(); lines.add("one"); lines.add(""); lines.add("two three"); which gives me the following when I convert it to a ...
-3
votes
1answer
43 views

How to perform text to column on SQL Server

I have a column that includes all the account groups and delimit by space. I want to split all these groups into each new column, similar to the 'Text to Columns' tool on excel that can split a single ...
0
votes
1answer
24 views

Split continous variable into equal size groups

I have a continous variable Total_testscore. I have split it in 4 groups, but they are not of equal sample size. How can I split the variable such that the resulting levels of the variable are of the ...
3
votes
3answers
42 views

How to split a sorted list by element length

I have a list of lists and it is sorted by the length of the children lists. e.g. [[str], [str1, str2], [str1, str2], [str1, str2, str3], [str1, str2, str3],...] I would like to split this list ...
0
votes
1answer
33 views

How to remove a silent chunk from split chunk in python?

I have some speech audio files that I want to split into 30 sec chunks, here is the code # Split Audios to 30 sec from pydub import AudioSegment from pydub.utils import make_chunks myaudio = ...
0
votes
0answers
31 views

Split handwritten number touching each other with openCV in Python for MNIST preprocessing

I'm looking to split number on image. My main problem is that the number may touch each other. so all technique with OpenCV contour found online doesn't work. Here the steps i've done so far. It's ...
0
votes
3answers
41 views

How to Rename Parts of Filename in Python

I am trying to rename a number of files using Python so that they follow a new naming convention that looks like: ~/directory/yyyy + qq + directory_name + ' Letter'. Right now, they are in this ...
0
votes
2answers
24 views

Is there a way of splitting a list of coordinates into separate parts, based on repeating values?

I am attempting to draw a number of separate geometries using matplotlib.pyplot, based on a series of coordinates. My current list of coordinates, containing two geometries looks like this: coords = [...
0
votes
0answers
10 views

How to fix Transaction Problems in Apache Camel using Splitter

I have a route where I am having transaction , and making insert query. in route there are two splitters , splitter inside splitter. From the outer Splitter I am calling one java method which inserts ...
2
votes
4answers
50 views

Get all text from body and split based on tags

I am creating an application in which I have a scenario where I am translating my whole page text, now I want to get the text from the page, I can simply get the text by $('body').text() but in my ...
1
vote
4answers
42 views

How can I return the first item of a split in a lambda in python?

so I need to split a data Frame column and get the first item to put in a new column with a lambda fuction. I can't figure out how to do that. df['Reason'] = df['title'].apply(lambda x: x.split(':')) ...

http://mssss.yulina-kosm.ru