Multiple aggregations of the same column using pandas GroupBy.agg()
Is there a pandas built-in way to apply two different aggregating functions `f1, f2` to the same column `df["returns"]`, without having to call `agg()` multiple times? Example dataframe: ``` import pa...
- Modified
- 19 Apr at 13:23
pass **kwargs argument to another function with **kwargs
I do not understand the following example, let's say I have these functions: ``` # python likes def save(filename, data, **kwargs): fo = openX(filename, "w", **kwargs) # <- #1 fo.write(data) ...
- Modified
- 16 Mar at 22:0
How to empty input field with jQuery
I am in a mobile app and I use an input field in order user submit a number. When I go back and return to the page that input field present the latest number input displayed at the input field. Is t...
Change Placeholder Text using jQuery
I am using a jQuery placeholder plugin(https://github.com/danielstocks/jQuery-Placeholder). I need to change the placeholder text with the change in dropdown menu. But it is not changing. Here is the ...
- Modified
- 10 Feb at 18:44
Check whether an array is empty
I have the following code ``` <?php $error = array(); $error['something'] = false; $error['somethingelse'] = false; if (!empty($error)) { echo 'Error'; } else { echo 'No errors'; } ?> ``` ...
PHP DOMDocument loadHTML not encoding UTF-8 correctly
I'm trying to parse some HTML using DOMDocument, but when I do, I suddenly lose my encoding (at least that is how it appears to me). ``` $profile = "<div><p>various japanese characters</p></div>"; $d...
- Modified
- 17 Oct at 22:31
can you host a private repository for your organization to use with npm?
Npm sounds like a great platform to use within an organization, curious if a private repo is possible, like with Nexus/Maven. Nothing comes up on Google :(
- Modified
- 27 Sep at 21:1
What is the difference between iterator and iterable and how to use them?
I am new in Java and I'm really confused with iterator and iterable. Can anyone explain to me and give some examples?
URL Encode a string in jQuery for an AJAX request
I'm implementing Google's Instant Search in my application. I'd like to fire off HTTP requests as the user types in the text input. The only problem I'm having is that when the user gets to a space in...
- Modified
- 27 Mar at 07:58
How do I install Eclipse Marketplace in Eclipse Classic?
I'm running Eclipse 3.6.1 Classic, which does not come with the Eclipse Marketplace plugin by default. I've looked around the Eclipse website, but I don't see an available plugin for installing Eclips...
- Modified
- 12 Mar at 21:29
Rebasing a Git merge commit
Take the following case: I have some work in a topic branch and now I'm ready to merge back to master: ``` * eb3b733 3 [master] [origin/master] | * b62cae6 2 [topic] |/ * 38abeae 1 ``` I perf...
- Modified
- 7 Sep at 14:4
Check if a Class Object is subclass of another Class Object in Java
I'm playing around with Java's reflection API and trying to handle some fields. Now I'm stuck with identifying the type of my fields. Strings are easy, just do `myField.getType().equals(String.class)`...
- Modified
- 12 Feb at 13:18
typedef fixed length array
I have to define a 24-bit data type.I am using `char[3]` to represent the type. Can I typedef `char[3]` to `type24`? I tried it in a code sample. I put `typedef char[3] type24;` in my header file. The...
How do I format a number with commas in T-SQL?
I'm running some administrative queries and compiling results from `sp_spaceused` in SQL Server 2008 to look at data/index space ratios of some tables in my database. Of course I am getting all sorts...
- Modified
- 7 Dec at 13:56
What's the proper way to install pip, virtualenv, and distribute for Python?
## Short Question - [pip](http://pip.readthedocs.org)[virtualenv](http://virtualenv.openplans.org/)[distribute](http://packages.python.org/distribute/) ## Background In [my answer](https://stack...
- Modified
- 20 Jun at 09:12
Remove first 4 characters of a string with PHP
How can I remove the first 4 characters of a string using PHP?
What does @media screen and (max-width: 1024px) mean in CSS?
I found this piece of code in a CSS file I inherited, but I can't make any sense out of it: ``` @media screen and (max-width: 1024px){ img.bg { left: 50%; margin-left: -512px; } }...
- Modified
- 26 Dec at 21:25
Android Split string
I have a string called `CurrentString` and is in the form of something like this `"Fruit: they taste good"`. I would like to split up the `CurrentString` using the `:` as the delimiter.So that way th...
Listing only directories in UNIX
I want to list only the directories in specified path (`ls` doesn't have such option). Also, can this be done with a single line command?
How can I list the contents of a directory in Python?
Can’t be hard, but I’m having a mental block.
Difference between Inheritance and Composition
Are Composition and Inheritance the same? If I want to implement the composition pattern, how can I do that in Java?
- Modified
- 28 Jun at 15:38
Command-line svn for Windows?
Is there a command-line based version of `svn` for Windows? I know I can get TortoiseSVN, but that just doesn't work for me.
- Modified
- 18 Aug at 11:27
Passing by reference in C
If C does not support passing a variable by reference, why does this work? ``` #include <stdio.h> void f(int *j) { (*j)++; } int main() { int i = 20; int *p = &i; f(p); printf("i = %d\n",...
- Modified
- 5 Sep at 21:57
PHP, get file name without file extension
I have this PHP code: ``` function ShowFileExtension($filepath) { preg_match('/[^?]*/', $filepath, $matches); $string = $matches[0]; $pattern = preg_split('/\./', $string, -1, PREG_SPLIT...
How do I check if there are duplicates in a flat list?
For example, given the list `['one', 'two', 'one']`, the algorithm should return `True`, whereas given `['one', 'two', 'three']` it should return `False`.
- Modified
- 2 Apr at 11:29