concat

After Pandas Dataframe pd.concat I get NaNs

*爱你&永不变心* 提交于 2019-12-03 08:13:56
I have three pandas df one of them has been 'row'-shifted and the first element is empty. When I concatenate the three df to obtain a single 3-column dataframe I get all NaN in two out of three columns: df1: S 2010-12-31 True 2011-01-01 False 2011-01-02 False df2: P 2010-12-31 2011-01-01 On 2011-01-02 On df3: C 2010-12-31 On 2011-01-01 On 2011-01-02 On res = pd.concat([df1, df2, df3]): P C S 2010-12-31 NaN NaN True 2011-01-01 NaN NaN False 2011-01-02 NaN NaN False The order seems to be inverted as well... Many thanks In [2]: index = pd.DatetimeIndex(['2010-12-31', '2011-01-01', '2011-01-02'])

Preserving Column Order - Python Pandas and Column Concat

旧巷老猫 提交于 2019-12-03 07:30:04
问题 So my google-fu doesn't seem to be doing me justice with what seems like should be a trivial procedure. In Pandas for Python I have 2 datasets, I want to merge them. This works fine using .concat. The issue is, .concat reorders my columns. From a data retrieval point of view, this is trivial. From a "I just want to open the file and quickly see the most important column" point of view, this is annoying. File1.csv Name Username Alias1 Tom Tomfoolery TJZ Meryl MsMeryl Mer Timmy Midsize Yoda

Python Pandas - Concat dataframes with different columns ignoring column names

百般思念 提交于 2019-12-03 05:44:16
I have two pandas.DataFrames which I would like to combine into one. The dataframes have the same number of columns, in the same order, but have column headings in different languages. How can I efficiently combine these dataframes? df_ger index Datum Zahl1 Zahl2 0 1-1-17 1 2 1 2-1-17 3 4 df_uk index Date No1 No2 0 1-1-17 5 6 1 2-1-17 7 8 desired output index Datum Zahl1 Zahl2 0 1-1-17 1 2 1 2-1-17 3 4 2 1-1-17 5 6 3 2-1-17 7 8 The only approach I came up with so far is to rename the column headings and then use pd.concat([df_ger, df_uk], axis=0, ignore_index=True) . However, I hope to find a

javascript, how can this function possibly return an empty array?

自古美人都是妖i 提交于 2019-12-03 04:52:22
function whatTheHeck(obj){ var arr = [] for(o in obj){ arr.concat(["what"]) } return arr } whatTheHeck({"one":1, "two": 2}) The concat function completely fails to do anything. But if I put a breakpoint on that line in Firebug and run the line as a watch it works fine. And the for loop iterates twice but in the end arr still equals []. Array.concat creates a new array - it does not modify the original so your current code is actually doing nothing. It does not modify arr . So, you need to change your function to this to see it actually work: function whatTheHeck(obj){ var arr = []; for(o in

Concat two String in JSF EL expression [duplicate]

折月煮酒 提交于 2019-12-03 01:03:36
This question already has an answer here : How to concatenate Strings in EL expression? (1 answer) I have the following el expression: <af:outputText value="#{viewArticle.publish ? ('Publish on ' + viewArticle.publishDate + ' by ' + viewArticle.publishFirstName + ' ' + viewArticle.publishLastName) : 'Draft version'}"/> But I am getting java.lang.NumberFormatException: For input string: "Publish on " How can I join the string? Marcio Aguiar You can use the String.concat function: <af:outputText value="#{viewArticle.publish ? 'Publish on '.concat(viewArticle.publishDate).concat(' by ').concat

attribute lookup str and objects like object.myvar

强颜欢笑 提交于 2019-12-02 23:06:16
问题 I want to know how i can concat object fields with a variable, it's hard to explain to me, let me give an example Example: My object have: myobject.name = 'Red' myobject.lastname = 'Foo' and I have a function like this: my function .......... some_dumb_field = name print myobject.some_dumb_field And this crashes!, how can i concat the str of the field like an object? 回答1: I'm guessing you are looking for getattr: print getattr(myobject, some_dumb_field) This will look up the attribute of

Preserving Column Order - Python Pandas and Column Concat

自古美人都是妖i 提交于 2019-12-02 22:20:40
So my google-fu doesn't seem to be doing me justice with what seems like should be a trivial procedure. In Pandas for Python I have 2 datasets, I want to merge them. This works fine using .concat. The issue is, .concat reorders my columns. From a data retrieval point of view, this is trivial. From a "I just want to open the file and quickly see the most important column" point of view, this is annoying. File1.csv Name Username Alias1 Tom Tomfoolery TJZ Meryl MsMeryl Mer Timmy Midsize Yoda File2.csv Name Username Alias 1 Alias 2 Bob Firedbob Fire Gingy Tom Tomfoolery TJZ Awww Result.csv Alias1

ffmpeg concat error-unusual video

纵然是瞬间 提交于 2019-12-02 20:59:32
问题 I have been trying to concatenate two 48 seconds video bits to one using the following command ffmpeg -f concat -safe 0 -i C:\moviepy-master\concat.txt -c copy output.mp4 When I played it using Windows media player the first 48 second plays fine but the player closes before playing the second bit . Then I tried to play it using VLC media player but in the second bit player but the audio and video are not in sync . Then I also tried giving inputs separately so the following error shows up C:

Laravel Eloquent model update according to condition of field value null or existing

倾然丶 夕夏残阳落幕 提交于 2019-12-02 18:33:02
问题 I am trying to update Laravel Eloquent model like this. Res_Reservations::where('time_id', $time['id']) ->where('date', $bus['date']) ->where('valid', config('config.TYPE_SCHEDULE_UNREMOVED')) ->where(function($query) use($time, $notesAdd) { $query->whereNull('reason', function($query) use ($time, $notesAdd) { return $query->update([ 'time_id' => $time['move'], 'reason' => $notesAdd ]); }) ->orWhere('reason', '=', '', function($query) use ($time, $notesAdd) { return $query->update([ 'time_id'

Need help again about joining tables

半城伤御伤魂 提交于 2019-12-02 16:38:04
问题 some context I asked a question about a MySQL request, my post can be found there: Need help about joining tables Now I have another problem related to that, so on my page I'm listing tickets from a database my request is: "SELECT glpi_tickets.id, glpi_tickets.name, GROUP_CONCAT( CASE WHEN glpi_tickets_users.type = 1 THEN CONCAT(glpi_users.firstname, ' ', glpi_users.realname) END) AS creator, GROUP_CONCAT( CASE WHEN glpi_tickets_users.type = 1 THEN CONCAT(glpi_tickets_users.users_id) END) AS