Quantcast
Channel: User killajoule - Stack Overflow
Browsing index pages (36 articles)
↧

How can I apply a decorator to an imported function? [duplicate]

Suppose I have imported a function:from random import randintand then want to apply a decorator to it. Is there some syntactic sugar for this, perhaps something like so?@decoratorrandintOr do I have...

View Article


How to filter rows of a numpy array

I am looking to apply a function to each row of a numpy array. If this function evaluates to True I will keep the row, otherwise I will discard it. For example, my function might be:def f(row): if...

View Article


Having trouble escaping quotes and braces

I am trying to execute the following line in Command Prompt:curl -X POST -d '{ "method" : "account_info", "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"} ] }'...

View Article

Programmatically get current IPython notebook cell output?

I have an imported function that runs in an IPython notebook (input cell X) which produces an output (in output cell X). After the function runs, I have some more code (also in input cell X); is there...

View Article

Pandas - Writing an excel file containing unicode - IllegalCharacterError

I have the following code:import pandas as pdx = [u'string with some unicode: \x16']df = pd.DataFrame(x)If I try to write this dataframe as an excel file:df.to_excel("test.xlsx")Or, if I try to write...

View Article


Using multiprocessing with a decorated function results in a PicklingError

I am trying to write a convenience function based on the multiprocessing library, that takes any function and argument, and runs that function using multiple processes. I have the following file...

View Article

python exec command does not pick up globals with custom scope?

Consider the following code:code = '''s = "hi"def x(): print(s)x()'''# does not workexec(code, {}, {})# worksexec(code, globals(), locals()) # worksWhen we use exec with custom globals and locals it...

View Article

Tensorflow - replicating model over multiple GPUs and sharing variables?

I am trying to run a simple feed-forward network on multiple GPUs (to asynchronously updated shared weights).However, I am unable to get the weights to be shared.From the research I've done I just need...

View Article


Image may be NSFW.
Clik here to view.

Display "long" pandas dataframe in jupyter notebook with "foldover" (wrapping)?

Let's say I have a pandas dataframe with many columns:I can view all of the columns by scrolling left/right. However, this is a bit inconvenient and I was wondering if there was an elegant way to...

View Article


What is the right cloud service(s) for real-time streaming and backtesting...

I wish to record time series data at a very high frequency. I am wondering if there is a elegant serverless solution that allows me to store, and react to real-time data.I want to use stored data to...

View Article

tensorflow tensor operations - tiling with dimension object does not work?

I Have a matrix M:[[101, 51, 12], [101, 19, 18]]Long story short, I need to create the following with tensorflow syntax:[[0, 0, 101], [0, 1, 51], [0, 2, 12], [1, 0, 101], [1, 1, 19], [1, 2, 18]]My...

View Article

Tensorflow, how to ensure that everything runs purely in the GPU?

My understanding is that tensorflow will take a computation graph and run it on both the gpu and cpu to max usage. How can I ensure that my code runs on the gpu only?

View Article

Recursive regex in python regex module?

I would like to capture all [[A-Za-z].]+ in my string, that is, all repeats of a alphabetic character followed by a dot.So for example, in "ABC A.B.C. UVWX U.V.W.X. XYZ XY.Z."I would like to pull out...

View Article


Wordpress - How can I allow authors/contributors to edit only a specific...

I created a simple wordpress plugin today which is essentially an options page. It is based on the instructions at this link: http://codex.wordpress.org/Creating_Options_Pages (there is example code at...

View Article

Regex - require a specific digit to be contained in \d+?

Consider the python code:import rere.findall('[0-9]+', 'XYZ 102 1030')which returns:['102', '1030']Can one write a regex that requires at least one occurance of the digit 3, i.e. I am interested in...

View Article


Is it possible to include multiple custom js files for Jupyter notebook?

I know I can add custom javascript to Jupyer notebooks by adding them to:.jupyter/custom/custom.jsHowever, is there a way to have multiple javascript files that are all loaded,...

View Article

How to specify difftool_args for git-difftool?

I am trying to use a custom diff tool for git diff. The following command does the job:git difftool --tool nbdime "file.ipynb"This starts up a diff viewer on the web, with the following...

View Article


Python multiprocessing apply_async never returns result on Windows 7

I am trying to follow a very simple multiprocessing example:import multiprocessing as mpdef cube(x): return x**3pool = mp.Pool(processes=2)results = [pool.apply_async(cube, args=x) for x in...

View Article

Celery - Completes task but never returns result

I've just installed Celery and am trying to follow the tutorial:I have a file called tasks.py with the following code:from celery import Celeryapp = Celery('tasks', backend='amqp',...

View Article

Image may be NSFW.
Clik here to view.

Parsing numerical data using Prolog?

I am new to prolog and am considering using it for a small data analysis application. Here is what I am seeking to accomplish:I have a CSV file with some data of the following...

View Article
Browsing index pages (36 articles)


Latest Images