concat

Rails' concat method and blocks with do…end doesn't work

 ̄綄美尐妖づ 提交于 2019-12-07 06:34:56
问题 I just read about Rails' concat method to clean up helpers that output something here http://thepugautomatic.com/2013/06/helpers/. I played around with it, and I have found out, that it doesn't react the same way to blocks with curly braces and to blocks with do...end. def output_something concat content_tag :strong { "hello" } # works concat content_tag :strong do "hello" end # doesn't work concat(content_tag :strong do "hello" end) # works, but doesn't make much sense to use with multi line

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

筅森魡賤 提交于 2019-12-07 03:52:28
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. In case of name column consists of unique values, print df name address number 0 Bob bob No.56 1 NaN @gmail.com NaN 2 Carly carly@world.com No.90 3 Gorge greg@yahoo NaN 4 NaN .com NaN 5 NaN NaN No.100 df['name'] = df[

Join 2 DataTables with many columns

十年热恋 提交于 2019-12-06 17:01:01
问题 I have a question, want to join 2 tables with same column. Table 1 has Name, LastName Columns and many other columns, Table 2 has Name, Comment and many other Columns. I want to join them with Name column and as Result should be Name, LastName, Comment and other Columns. I tried with outer left Linq but don't know how to write select new because don't know how many other columns i have. My Table 1: Name1 LastName ... Niki Row ... Hube Slang ... Koke Mi ... ... ... ... ... ... ... Table 2:

Compare Value with Comma Separated String SQL PHP

不打扰是莪最后的温柔 提交于 2019-12-06 15:21:12
I am using two-tier chained select boxes on my webpage to filter data...I am having problem with my query for the second select values... table: id name cat loc 1 ABC resort mall road 2 BCD banquet hall mall road 3 CDE farm house, banquet hall pakhowal road 4 DEF hotel ferozpur road 5 FEZ hotel fountain chowk 6 ZEX resort mall road I have two select boxes in which first one is for DISTINCT cat values...which is working perfectly for me... Query i am using is: select distinct cat from (select trim(substring_index(substring_index (concat(cat,',,'),',',n),',',-1)) as cat from table t cross join

JPA CriterialBuilder.concat force to use concat function

感情迁移 提交于 2019-12-06 10:24:27
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() function, instead of the || operator? select distinct concat(col_1, col_2) Update: From the error we can

Concatenate Object values

久未见 提交于 2019-12-06 09:19:40
问题 I have a JavaScript Object and I'm sure the value of any key is an array (even empty in some case): {key1:["a","b","c"],key2:["d","e","f"],key3:...} Aside from using Underscore, is there any way to concatenate all the values of this Object (and create a new array)? At the moment I get the keys name using Object.keys , then I loop and concatenate. Any help is appreciated. 回答1: var obj = {key1:["a","b","c"],key2:["d","e","f"]}; var arr = Object.keys(obj).reduce(function(res, v) { return res

Merge Many json strings with python pandas inputs

ぃ、小莉子 提交于 2019-12-06 08:51:22
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', 'v', 'u', 't', 's', 'r', 'q', 'o'] ) In [64]: panel Out[64]: <class 'pandas.core.panel.Panel'>

How do I pair rows together in MYSQL?

﹥>﹥吖頭↗ 提交于 2019-12-06 07:30:50
问题 I'm working on a simple time tracking app. I've created a table that logs the IN and OUT times of employees. Here is an example of how my data currently looks: E_ID | In_Out | Date_Time ------------------------------------ 3 | I | 2012-08-19 15:41:52 3 | O | 2012-08-19 17:30:22 1 | I | 2012-08-19 18:51:11 3 | I | 2012-08-19 18:55:52 1 | O | 2012-08-19 20:41:52 3 | O | 2012-08-19 21:50:30 Im trying to create a query that will pair the IN and OUT times of an employee into one row like this: E

SQL Group by with concat

五迷三道 提交于 2019-12-06 07:09:43
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 You can create a function to concat the values create function dbo.concatTable1(@column1 int) returns varchar(8000) as begin

Pandas Concat increases number of rows

泪湿孤枕 提交于 2019-12-06 06:27:03
I'm concatenating two dataframes, so I want to one dataframe is located to another. But first I did some transformation to initial dataframe: scaler = MinMaxScaler() real_data = pd.DataFrame(scaler.fit_transform(df[real_columns]), columns = real_columns) And then concatenate: categorial_data = pd.get_dummies(df[categor_columns], prefix_sep= '__') train = pd.concat([real_data, categorial_data], axis=1, ignore_index=True) I dont know why, but number of rows increased: print(df.shape, real_data.shape, categorial_data.shape, train.shape) (1700645, 23) (1700645, 16) (1700645, 130) (1703915, 146)