concatenation

Concatenate dataframes with multi-index in pandas dataframe

核能气质少年 提交于 2019-12-02 03:37:26
问题 I have two dataframes df1 and df2 : In [56]: df1.head() Out[56]: col7 col8 col9 alpha0 D0 alpha0 D0 alpha0 D0 F35_HC_531d.dat 1.103999 1.103999 1.364399 1.358938 3.171808 1.946894 F35_HC_532d.dat 0.000000 0.000000 1.636934 1.635594 4.359431 2.362530 F35_HC_533d.dat 0.826599 0.826599 1.463956 1.390134 3.860629 2.199387 F35_HC_534d.dat 1.055350 1.020555 3.112200 2.498257 3.394307 2.090668 F52_HC_472d.dat 3.808008 2.912733 3.594062 2.336720 3.027449 2.216112 In [62]: df2.head() Out[62]: col7

ORDER BY suddenly conflicting with VARCHAR concatenation in TSQL

五迷三道 提交于 2019-12-02 03:22:40
I have code in Sql Server 2008 which concatenates some strings from a query into a variable using the tried-and-true SELECT @VAR = @VAR + FIELD FROM TABLE ORDER BY OTHERFIELD syntax. This is my exact SQL: SELECT @SQL = @SQL + ISNULL(FORMULA, CASE WHEN USEMAP = 1 THEN 'dbo.getFieldTranslation('+CONVERT(VARCHAR,ROWID)+', [' + ISNULL(ENCOMPASSFIELD,'') + '])' ELSE '[' + ISNULL(ENCOMPASSFIELD,'') + ']' END ) + ' AS "' + FILECOLNAME + '",' + @CRLF FROM dbo.EXPORTMAP_EX WHERE WAREHOUSEID = @WHSID ORDER BY ORDERIDX This was working beautifully and perfectly. Then suddenly today, it stopped working.

using variable with jquery selector

99封情书 提交于 2019-12-02 02:37:08
I have following lines of code and I want to use visibleoffer variable as selector. How can I concatenate it? var visibleoffer = '.' + obj.parents('tbody').attr('providername') + ' .visible-offers'; //visibleoffer = .Txy .visible-offers $(obj).parents('.Provider').find(".Offers:not(.HideByProviderFilter,.HideByMainFilter,.HideByProviderFilter.HideByMainFilter,+ visibleoffer)").length; So it becomes: $(obj).parents('.Provider').find(".Offers:not(.HideByProviderFilter,.HideByMainFilter,.HideByProviderFilter.HideByMainFilter,.Txy .visible-offers)").length; You need to concatenate variable while

Remove repeating data in a column

好久不见. 提交于 2019-12-02 02:34:33
I am currently developing an ordering system where a customer can order many items. I also have an admin where he/she can see all the orders on that day. The Admin can view the name of the customer, the total payable, the products and the quantity of the product the customer have ordered. I am currently seeing this results using my query. Name | Payable | Product | Quantity Test | 165 | keychain | 3 Test | 165 | Tumbler | 1 Miguel | 525 | Keychain | 3 Miguel | 525 | Magic Mug | 3 Dandel | 1010 | keychain | 3 Dandel | 1010 | T-shirt | 2 Dandel | 1010 | Keychain | 3 Dandel | 1010 | Mug | 5 This

Performance issue with Splitting long log line into two

纵然是瞬间 提交于 2019-12-02 02:09:03
问题 When we split a long line of code into two for readability, it introduces a plus sign between the lines (if split between the text). For example splitting a long line in middle of text which is logging some text. So, this should be avoided given additional string concatenation it brings into picture ? Or trade off of better readability weighs higher ? 回答1: All the usual Java compilers are way too mature to do something dumb like concatenate string literals at run time. Let's check. Given this

Multiple rows in one column SQL Server

℡╲_俬逩灬. 提交于 2019-12-02 01:52:39
问题 I want to concatenate multiple rows in one column. I found many examples in Internet but does not working for me. What am I doing wrong? SELECT UserID, STUFF((SELECT '; ' + Email.Email From Email where UserEmail.EmailID = Email.ID for xml path('')),1,1, '') AS Emails From UserEmail where UserID = 1 I'm still having the information like this UserID Email 1 abc@yahoo.com 1 cde@gmail.com --EDIT-- Ok, I did this change but still having 2 rows. If I apply distinct this will fix my problem but why

Python raw_input messing up string concatenation

二次信任 提交于 2019-12-02 01:50:56
问题 I am trying to do something relatively simple in Python and am surprised at how badly this isn't working for how simple it should be. I'm here just trying to concatenate three simple strings. The input typed at raw_input is "abc" in all cases below: proj = raw_input("Name of project: ") print proj ProjRegex = 'test1' + proj + 'test2' print ProjRegex Yields: abc test2abc Case 2 proj = raw_input("Name of project: ") print proj ProjRegex = 'test1%stest2' % (proj) print ProjRegex Yields: abc

Concatenating Variables Into String to be Set to a Range in VBA

…衆ロ難τιáo~ 提交于 2019-12-02 01:35:14
I am having a problem with a particular line of code: ActiveSheet.Range("A" & rowCount & ":" & Mid(alphabet, totHdrLngth, 1) & belowRowCount) Where alphabet is a string containing uppercase letters A to Z. I keep getting the following error: Run-time error '5': Invalid Procedure call or argument I tried creating a String "inRange" and changing the code to this: inRange = "A" & rowCount & ":" & Mid(alphabet, totHdrLngth, 1) & belowRowCount curRange = ActiveSheet.Range(inRange) But that did not help (as I thought it wouldn't). Any suggestions? Although creating ranges like this is frowned upon

Python raw_input messing up string concatenation

陌路散爱 提交于 2019-12-02 01:20:31
I am trying to do something relatively simple in Python and am surprised at how badly this isn't working for how simple it should be. I'm here just trying to concatenate three simple strings. The input typed at raw_input is "abc" in all cases below: proj = raw_input("Name of project: ") print proj ProjRegex = 'test1' + proj + 'test2' print ProjRegex Yields: abc test2abc Case 2 proj = raw_input("Name of project: ") print proj ProjRegex = 'test1%stest2' % (proj) print ProjRegex Yields: abc test2abc Note that in both cases instead of printing "test1abctest2" , as expected, it's substituting test2

Concatenation of a field related to multiple rows of a record in query set in Django

大城市里の小女人 提交于 2019-12-02 01:14:51
I have to models with one to many relation with which I try to distinguish the type of my records. Let's say First model is dedicated to Book information and second model is some types such as A, B , C and there is an indirect relation from the Type table to Book, so each book could be A, B or C or any possible combination of Types. I want to use concatenation (or any other possible function in annotation to gather all the types in a field). Book.objects.all( ).annotate( Types = F('TableRelation__Type__Name') ).annotate( CombinedTypes = Concat('Types') ) which throws an error since only one