concat

concatenation of two unicode srings?

丶灬走出姿态 提交于 2019-12-09 03:56:29
问题 #!/usr/bin/python # -*- coding: utf-8 -*- import re separators = [u"।", u",", u"."] dat=open(r"C:\Users\User\Desktop\text4.txt",'r').read() text=dat.decode("utf-8") wros=text.split() out="" import string space=" " counter=0; for word in wros: out=u" ".join(word) writ=open("C:\\Users\\User\\Desktop\\text5.txt",'w') writ.write(out.encode('utf-8')) writ.close() text4.txt contains भारत का इतिहास काफी समृद्ध एवं विस्तृत है। text5.txt outputs as ह ै । desired output is भारत का इतिहास काफी समृद्ध

Concatenate table name on UPDATE statement using MySQL user-defined variable

狂风中的少年 提交于 2019-12-08 13:54:31
I am trying to set the prefix on table names for an UPDATE statement. I have to run this UPDATE statement dozens of times on multiple databases, each has a different table prefix. The code below does not work, but this is the idea of what I am trying to accomplish. SET @prefix = 'prefix_'; SET @old = "old_value"; SET @new = "new_value"; UPDATE CONCAT(@prefix, 'table1') SET some_field = REPLACE(some_field, @old, @new); UPDATE CONCAT(@prefix, 'table2') SET some_field = REPLACE(some_field, @old, @new); UPDATE CONCAT(@prefix, 'table3') SET some_field = REPLACE(some_field, @old, @new); Written

Concat String in a for loop

烂漫一生 提交于 2019-12-08 09:31:26
问题 I'm trying to create a program that takes each number typed in by the user and sort them out as even, odd and the number zero values. The result should look like something like this: User Input: 14005 Output: Even Numbers: 4 Odd Numbers: 1, 5 Zero's: 0, 0 This is the code I've written, I thought of using string concatination in order to add a new value each time the loop checks for the next character, don't know whether I'm thinking right or not though, would appriciate if someone could tell

Concatenate table name on UPDATE statement using MySQL user-defined variable

僤鯓⒐⒋嵵緔 提交于 2019-12-08 04:11:06
问题 I am trying to set the prefix on table names for an UPDATE statement. I have to run this UPDATE statement dozens of times on multiple databases, each has a different table prefix. The code below does not work, but this is the idea of what I am trying to accomplish. SET @prefix = 'prefix_'; SET @old = "old_value"; SET @new = "new_value"; UPDATE CONCAT(@prefix, 'table1') SET some_field = REPLACE(some_field, @old, @new); UPDATE CONCAT(@prefix, 'table2') SET some_field = REPLACE(some_field, @old,

python pandas merge two or more lines of text into one line

江枫思渺然 提交于 2019-12-08 03:43:45
问题 I have data frame with text data like below, name | address | number 1 Bob bob No.56 2 @gmail.com 3 Carly carly@world.com No.90 4 Gorge greg@yahoo 5 .com 6 No.100 and want to make it like this frame. name | address | number 1 Bob bob@gmail.com No.56 2 Carly carly@world.com No.90 3 Gorge greg@yahoo.com No.100 I am using pandas to read file but not sure how to use merge or concat. 回答1: In case of name column consists of unique values, print df name address number 0 Bob bob No.56 1 NaN @gmail

Merge Many json strings with python pandas inputs

依然范特西╮ 提交于 2019-12-08 01:02:29
问题 Summary I have created data objects that are comprised of (among other things), of pandas objects like DataFrame s and Panel s. I'm looking to serialize these objects into json , and speed is a primary consideration. Example using a pandas.Panel Say for instance I have a panel like so: In [54]: panel = pandas.Panel( numpy.random.randn(5, 100, 10), items = ['a', 'b', 'c', 'd', 'e'], major_axis = pandas.DatetimeIndex(start = '01/01/2000', freq = 'b', periods = 100 ), minor_axis = ['z', 'y', 'x'

SQL Group by with concat

妖精的绣舞 提交于 2019-12-08 01:01:48
问题 Hi Can anybody help me with the following. I need to write a MS SQL statment to achive the following: Table1 has 2 columns: Column1 and Column2 Data in table1 looks like Column1 Column2 1 a 1 b 1 c 2 w 2 e 3 x I need my Sql statment to output as following Column1 Column2 1 a, b, c 2 w, e 3 x So in other words I need to group by column1 and have the column2 values concatenate with comma seperated. Please note this will need to be able to run on SQL Server 2000 and above 回答1: You can create a

JPA CriterialBuilder.concat force to use concat function

廉价感情. 提交于 2019-12-08 00:37:14
问题 I'm using CriteriaBuilder.concat to concatenate 2 Strings, using code below: Expression<String> concat = criteriaBuilder.concat(expr1, expr2) But the generated SQL is something like: select distinct col_1 || col_2 which causes org.hibernate.hql.ast.QuerySyntaxException : expecting CLOSE, found '||' near line 1, column 48 [ select count(distinct generatedAlias0.hostname || generatedAlias0.device) from ... ^(1,48) I wonder how to force it to generate the following SQL which uses the concat()

JavaScript : unable to merge two arrays

北战南征 提交于 2019-12-07 16:33:13
问题 I'm not a veteran of JavaScript and I have a little problem : In an AngularJS controller, I get 2 arrays from a WebService of the form [{"id":"1", "name":"aname1"}, {"id":"2", "name":"aname2"}] . They have both the same structure (this shouldn't be important). With concat() or push() I'm unable to merge these arrays together, and I don't understand why. I tried var arrayS = Service.list(); // Get data from WebService var arrayAE = ActeurExterne.list(); // Idem var arrayRes = arrayS.concat

merging multiple columns into one columns in pandas

好久不见. 提交于 2019-12-07 14:55:41
问题 I have a dataframe called ref(first dataframe) with columns c1, c2 ,c3 and c4. ref= pd.DataFrame([[1,3,.3,7],[0,4,.5,4.5],[2,5,.6,3]], columns=['c1','c2','c3','c4']) print(ref) c1 c2 c3 c4 0 1 3 0.3 7.0 1 0 4 0.5 4.5 2 2 5 0.6 3.0 I wanted to create a new column i.e, c5 ( second dataframe) that has all the values from columns c1,c2,c3 and c4. I tried concat, merge columns but i cannot get it work. Please let me know if you have a solutions? 回答1: You can use unstack for creating Series from