Hello people, I'm currently working on a python module providing tools for co-workers to use and some of the functions I'm trying to provide can return quite a bit of useful information (say, 5 return values), but in most use case, only the first two
I am having issues with creating a function that takes a list of tuples and then returns one string which is the first character of each tuple. Below is my current code, but nothing it happening, I do not get a syntax error. Any help would be appreci
I've a question regarding embedding python into a C++ application. The setup is as follows: I have a large C++ application which generates some data (renders images in real-time) and displays them. I have also trained a neural network in python using
I am brand new to programming and am working through the "Automate the Boring Stuff" book for Python 3. I've seen several other people with questions on the 'Comma Code' project but not my specific problem. I have come up with a 'working' bit to
I am trying to get AWS spot price history and I have been getting help from this tutorial: https://medium.com/cloud-uprising/the-data-science-of-aws-spot-pricing-8bed655caed2#.nk3k2m1z0 I am able to connect to the given region as I get back the conne
I am new to Apache Spark (Pyspark) and would be glad to get some help resolving this problem. I am currently using Pyspark 1.6 (Had to ditch 2.0 since there is not MQTT support). So, I have a data frame that has the following information, +----------
Picture a 4x4 grid in a tkinter window. I want to expand the cell at row 2, column 2 but not everything else on row 2 or column 2. Im designing a text window with selectable options on the left side in rows 1-15. Making row 2 with weight 1 and column
I have a simple code snippet where I set dictionary values as empty lists: new_dict = {} for i in range(1, 13): new_dict[i] = [] Now, if inside the loop on the next line I would type new_dict[i] and add a dot, I expect PyCharm to show me a list of me
I have a simple pandas data frame. Trying to plot from the Windows 10 terminal session of IPython gives me this: In [4]: df = pd.DataFrame({'Y':[1, 3, 5, 7, 9], 'X':[0, 2, 4, 6, 8]}) In [5]: df Out[5]: X Y 0 0 1 1 2 3 2 4 5 3 6 7 4 8 9 In [6]: df.plo
So I have this script (running Python 3.5) using Google API and Newspaper. It searches google for articles that have to do with sleep. And then using Newspaper, I iterate over those URLS. And all I'm asking Newspaper to do is return a list of keyword
So I am getting lost somewhere in converting unicode to utf-8. I am trying to define some JSON containing unicode characters, and writing them to file. When printing to the terminal the character is represented as '\u2606'. When having a look at the
Skip to Update 2 below, if you don't want to read too much background. I'm trying to implement a model for simple orbital simulations (two body). However, when I try to use the code I've written, the plots generated from the result look quite odd. Th
I have a small problem with figuring out how {% url 'something' %} works in django templates. When I run my website in debug mode, I see this in stdout: web_1 | [21/Dec/2015 11:29:45] "GET /accounts/profile HTTP/1.1" 302 0 web_1 | /usr/local/lib
I want to write a script where a user can get a list of all of the files in a directory and then type in the full filename to view them. Right now, my script will let a user do this once and then it continues onto the next portion of the script. I wo
Issue I'm trying to initiate an Express Checkout transaction via server-side python (I'm using Flask). I'm using the standard paypal python SDK. I'm following the Express Checkout workflow in the documents. The PayPal documentation for Express Checko
I've implemented a BloomFilter in python 3.3, and got different results every session. Drilling down this weird behavior got me to the internal hash() function - it returns different hash values for the same string every session. Example: >>> has
I'm trying to compare two sets in python that contain nan but struggling to do so because {float('nan')} != {float('nan')}. For example: s1 = {float('nan'), 1} s2 = {float('nan'), 1, 2} assert set.issubset(s1, s2) And I get an assertion error. How ca
Let's say that I have a file with this in it: passcode Now, what I want to do is have some code with user input that should test if what the user entered what is equal to what is in the file. Is there a any way I can do this? Here is the code that I
I need help with some MySQL commands. My MySQL table look's like this mysql> DESCRIBE sensor_readout; +-----------+-----------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+-----------+------
In my program I current create a numpy array full of zeros and then for loop through each element replacing it with the desired value. Is there a more efficient way of doing this? Below is an example of what I am doing however, instead of a int I hav
I am trying to provide a recursive method that provides a list of all the possible combinations when given a list of courses. E.g course = [Entree, Dessert] This is what I have so far: Entree = ["pumkinsoup","antipasto"] Dessert = [&qu
Assume I have some matplotlib code that looks like the following: ### import statements, etc. ### ax1 = fig.add_subplot(221) ### plot some 2D data to ax1 ### ax2 = fig.add_subplot(221, projection='3d') ### plot some 3D data to ax2 ### The effect of t
I'm somewhat confused about multiprocessing. I'm a 3 years Python programmer, however never really needed to perform tasks in parallel (not just asynchronously). But what I know, or thought to know, is that when using the multiprocessing module in Py
I'd like to write a method in python which dynamically reads a module and creates a list of all the functions in that module. Then I'd like to loop through this list and call each function. So far I have the following code: import mymodule from inspe
I'm creating a small tool for data visualization. The GUI is created with Pygtk and very simple. After the user has entered a filename he can press the button "calc" to see the output. The output is rendered by pycairo and presented in a gtk.Dra
I understand that my question might sound stupid, and that there might be something in the language definition that explicitly prohibits this notion, but since I don't know about this prohibition, I was wondering whether someone could shed some light
Is it possible to convert the following to a python list comprehension: values = [a,b,c,d,...] converted_values = [] for item in values: if type(item) == datetime.date: converted_values.append(item) else: converted_values.append(item.decode('utf-8'))
I feel as if I oversimplify/overcomplexify doc parsing at times, here is what I often do: data = open('data.txt', 'rb').read() for line in data.split('\n'): if not line.strip(): continue and this: import csv filenames=['first_name', 'last_name', 'ema
I'm developing an app (an API) in python and I would like to offer some of its functionality through a web interface (like web services do). I've been looking at django, but I don't know if really fits well in my idea. I only want to create a web pag
In Python one can get a dictionary of all local and global variables in the current scope with the built-in functions locals() and globals(). Is there some equivalent way of doing this in Javascript? For instance, I would like to do something like th