delimiter

split string last delimiter

烂漫一生 提交于 2019-11-28 13:52:33
I need help figuring out how to split strings in a column of a data frame based on the last delimiter when I have varying numbers of the same delimiter in R. For example, col1 <- c('a', 'b', 'c') col2 <- c('a_b', 'a_b_c', 'a_b_c_d') df <- data.frame(cbind(col1, col2)) And I would like to split df$col2 to have a data frame that looks like: col1 <- c('a', 'b', 'c') col2 <- c('a', 'a_b', 'a_b_c') col3 <- c('b', 'c', 'd') These use no packages. They assume that each element of col2 has at least one underscore. (See note if lifting this restriction is needed.) 1) The first regular expression (.*)_

Issues converting csv to xls in Java? Only core Java experience needed - question not related to import

扶醉桌前 提交于 2019-11-28 13:37:35
问题 First of all, I understand that it's unusual that I want to up-convert like this, but please bear with me. We get these csv files via website export and we have no options to get it in any other form. Now, onto the question: I have this old code that will do this process for me. It basically reads each line, then picks out each value between the , s. This worked great for some samples that I converted, but when it came down to working with the samples given, some values were out of place. I

Do certain characters take more bytes than others?

回眸只為那壹抹淺笑 提交于 2019-11-28 11:36:36
I'm not very experienced with lower level things such as howmany bytes a character is. I tried finding out if one character equals one byte, but without success. I need to set a delimiter used for socket connections between a server and clients. This delimiter has to be as small (in bytes) as possible, to minimize bandwidth. The current delimiter is "#". Would getting an other delimiter decrease my bandwidth? It depends on what character encoding you use to translate between characters and bytes (which are not at all the same thing): In ASCII or ISO 8859, each character is represented by one

python pandas read_csv delimiter in column data

試著忘記壹切 提交于 2019-11-28 11:23:56
I'm having this type of CSV file: 12012;My Name is Mike. What is your's?;3;0 1522;In my opinion: It's cool; or at least not bad;4;0 21427;Hello. I like this feature!;5;1 I want to get this data into da pandas.DataFrame . But read_csv(sep=";") throws exceptions due to the semicolon in the user generated message column in line 2 (In my opinion: It's cool; or at least not bad). All remaining columns constantly have numeric dtypes. What is the most convenient method to manage this? Dealing with unquoted delimiters is always a nuisance. In this case, since it looks like the broken text is known to

Reading CSV files in numpy where delimiter is “,”

人走茶凉 提交于 2019-11-28 11:11:22
I've got a CSV file with a format that looks like this: "FieldName1", "FieldName2", "FieldName3", "FieldName4" "04/13/2010 14:45:07.008", "7.59484916392", "10", "6.552373" "04/13/2010 14:45:22.010", "6.55478493312", "9", "3.5378543" ... Note that there are double quote characters at the start and end of each line in the CSV file, and the "," string is used to delimit fields within each line. The number of fields in the CSV file can vary from file to file. When I try to read this into numpy via: import numpy as np data = np.genfromtxt(csvfile, dtype=None, delimiter=',', names=True) all the data

Split delimited string value into rows

荒凉一梦 提交于 2019-11-28 10:36:29
Some external data vendor wants to give me a data field - pipe delimited string value, which I find quite difficult to deal with. Without help from an application programming language, is there a way to transform the string value into rows? There is a difficulty however, the field has unknown number of delimited elements. DB engine in question is MySQL. For example: Input: Tuple(1, "a|b|c") Output: Tuple(1, "a") Tuple(1, "b") Tuple(1, "c") It may not be as difficult as I initially thought. This is a general approach: Count number of occurrences of the delimiter length(val) - length(replace(val

Is There An Efficient Whole Word Search Function in Delphi?

别说谁变了你拦得住时间么 提交于 2019-11-28 10:14:07
In Delphi 2009 or later (Unicode), are there any built-in functions or small routines written somewhere that will do a reasonably efficient whole word search where you provide the delimiters that define the word, e.g.: function ContainsWord(Word, Str: string): boolean; const { Delim holds the delimiters that are on either side of the word } Delim = ' .;,:(){}"/\<>!?[]'#$91#$92#$93#$94'-+*='#$A0#$84; where: Word: string; { is the Unicode string to search for } Str: string; { is the Unicode string to be searched } I only need this to return a true or false value if the "Word" is in the string.

reading tab delimited textfile java

元气小坏坏 提交于 2019-11-28 09:45:46
问题 10 aaa aaa aaa bbb bbb bbb ccc ccc ccc ddd ddd ddd I have a textfile that Im trying to read with tab delimiters. whenever i read the file, i get an arrayindexoutofbound error after the 10. i search online and found that i have to add a -1 behind the \t but i still get the same error. try{ Scanner scan = new Scanner(new File("1.txt")); String line=""; int readline = Integer.parseInt(scan.nextLine());// while (scan.hasNextLine()) { line = scan.nextLine(); if(line.equals("ccc")) { break; }

Hive query output delimiter

时间秒杀一切 提交于 2019-11-28 09:31:49
I have 2 tables in Hive - first is external, the second one is managed. Managed table is populated from external using INSERT OVERWRITE...SELECT FROM external_table. Both tables are created with row delimited by ','. When I run selects queries into file, the delimiter in result file is Tab, but I need comma. How to change it to comma, I see no properties for that. First of all, you need to change you field delimiter , not your line delimiter ie. hive >> CREATE TABLE some_table (col1 int, col2 int, col3 string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TEXTFILE; Secondly, if you

Stored Procedures Using MySQL Workbench

我的未来我决定 提交于 2019-11-28 09:02:39
问题 Very new to the environment, I have a question about a line that's added to the end of my code. The guide I'm following is: http://net.tutsplus.com/tutorials/an-introduction-to-stored-procedures/ If anyone has a better one regarding MySQL stored procedures, I'm all ears. Before I ask, this is the environment I'm using: OS: Windows 7 / WAMP (MySQL 5.5.24) / MySQL Workbench I'm instructed to define a delimiter; in my case I'm sticking with the default '$$.' The stored procedure I created is: