Transposing a subset of columns in a Pandas DataFrame while using others as grouping variable?

Python
Let's say I have a Pandas dataframe (that is already in the dataframe format): x = [[1,2,8,7,9],[1,3,5.6,4.5,4],[2,3,4.5,5,5]] df = pd.DataFrame(x, c...
1 year ago

Update list in-place, converting 'True'/'False' elements to 1/0

Python
In python, supposed I have a list: l = [ 'True', 'False', 'myname', 1, 0, 'foo' ] and I want to convert the strings 'True' or 'False' to 1 or 0, ...
1 year ago

Swift... how can I make an image change when a button its pressed and return it back to normal?

Swift
Swift... how can I make an image change when a button its pressed and return it back to normal as soon as the finger is not longer touching the button...
1 year ago

Using Gradle to split external libraries in separated dex files to solve Android Dalvik 64k methods limit

Android
Is there a proper/easy way to solve the 64k methods limit using Gradle? I mean some custom Gradle task to use pre-dexed jars to create separated dex ...
1 year ago

How can I prevent a library from masking functions in R

R
A typical situation is the following: library(dplyr) library(xgboost) When I import the library xgboost, the function slice of dplyr is masked, and...
1 year ago

Remove percent-escaped characters from string

Swift
How do I remove, not decode, percent-escaped characters from a string using Swift. For instance: "hello%20there" should become "hellothere" EDIT: I...
1 year ago

How can I add to array my custom class and pass Intent

Android
I simply want to add array to my custom class like "Dog" class to array and put it to Intent after that I want to get that extras using getIntent().ge...
1 year ago

How do I place divs side by side?

CSS
What I want to do is to place the divs next to each other rather than how they are that they stack over each other. side note: I want the divs to be...
1 year ago

NSOperation vs Grand Central Dispatch

iOS
I'm learning about concurrent programming for iOS. So far I've read about NSOperation/NSOperationQueue and GCD. What are the reasons for using NSOpera...
1 year ago

Infinite Recursion when convert object to JSON using Jackson

Java
I have this class that I am using to store preferences for a tool. This class uses the toString() to convert itself to JSON. I am getting this infinit...
1 year ago

Javascript regex - why a terminating space is needed to match the whole string

Javascript
I am parsing sql WHERE clauses and I have the following javascript (regex) (?:(?:(between )(['"]?)(.*?)(\2)( and )(['"]?)(.*?)(\6))) That I am mat...
1 year ago

Counting sub-element in string?

Python
Say I have a string = "Nobody will give me pancakes anymore" I want to count each word in the string. So I do string.split() to get a list in order t...
1 year ago

Animated Views move outside of my layout

Android
I have a ScrollView which contains several RelativeLayouts and LinearLayouts like this: <ScrollView xmlns:android="http://schemas.android.com...
1 year ago

Android: center and right alignment inside LinearLayout

Android
I have two Linear Layouts one inside the other. In the second one I have a Switch button, a TextView and a FloatingActionButton. I want to put these 3...
1 year ago

Ellipsis not working in flex container

CSS
I'm trying to create a layout (which will be a music player) with flex. I have 3 buttons (previous, play, and next, represented by the red squares) w...
1 year ago

Root component renders itself in router outlet

Javascript
Here is the structure of the angular 2 js(ES2015) project: src ├── app.js ├── components │   ├── app │   ├── index.js │   ├── list │   ├── loess │   ...
1 year ago

calculate quantity multiply unit price input and equal input will be subtotal and sum all subtotals

jQuery
I need to calculate quantity multiply unit price inputs and equal input will be subtotal and sum all subtotals... I used this code in javascript, and...
1 year ago

How can I reload an activity from a listview to update information of a database?

Android
I'm trying to implement something like this: I have a main class with a layout from where I get some data from the database and plot it as shown in...
1 year ago

CSS general element takes precedence over classes?

CSS
ul { width: 250px; } li { margin: 10px; } ul.illuminations { list-style-position: outside; } ul.season { list-style-position: in...
1 year ago

Code for a left side menu opened by toggle

HTML
I'm currently doing a site where I want a toggle/icon to open the menu which slides in from the left on desktop view, then in mobile I just want it to...
1 year ago