text stringlengths 226 34.5k |
|---|
Merge Sort on Python: Unusual pattern of result obtained
Question: I have a unsorted array of 10,000 integers from 0 to 9,999. I wanted to apply
merge sort on this unsorted array and I wrote the following code-
import sys
def merge_sort(data):
result = []
if len(data) <= 1:
... |
Read vertically all the values of all the possible combinations of an unknown number of lists with different sizes in Python
Question: I want implement a function that combines **vertically** all the elements of
an **unknown number of lists** in Python. Each list has a **different size**.
E.g., this is the list of list... |
Python-how to calculate the highest tf-idf value of the first 100 words in different tweeets
Question: I have tens of thounds of tweets saved in one .txt file, I want to calculate
calculate the highest tf-idf value of the first 100 words in these tweeets, in
other words, I want to compare the word's tf-idf value betwee... |
Pandas and matplotlib doing linear graph
Question: Any idea whats missing in my code to avoid part of the graph/canvas and dates
being out of the PNG image? Is it possible to have the dates written in 180
degrees or in vertical to not use so much space of the grapth?
My data set is:
15/03/16 3000 ... |
Removing accents with Python - Unicode doesn't work
Question: I'm trying to clean a spanish text with the following code:
import re
import unicodedata
file = open("dirty.txt").readlines()
archivo = open("cleanText.txt", "w")
textLowerCase = file[i].lower()
unicodeText = textLowerCase.... |
Unknown CUDA error when importing theano
Question: In python, after importing theano, I get the following:
In [1]: import theano
WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not available
(error: Unable to get the number of gpus available: unknown error)
I'm running... |
Scatter plot with a slider in python
Question: Hey I am trying to create a scatter plot with a slider that updates the plot
as I slide across. This is my code so far. It draws a scatter plot and a
slider but as I move it around, nothing happens. I suspect that the problem is
with the `.set_ydata`bit but I can't seem to... |
How to parse a list in python using re
Question: I am trying to parse a list to get the individual images returned by the bash
script (stored in the list errors in py script). How can I do this with "re" ?
**bash script**
#!/bin/bash
value(){
for entry in *
do
if expr "$(file -b $entry)"... |
Using python language to acces a cmd window
Question: It is possible to make a python script which opens a cmd window and enters 5
commands one by one, and after waits for an external trigger to continue
entering another 2 commands in the same window.
It is posibble? I hope You understand what I ask. PS: maybe you can... |
Node disappears after restart server. Neo4j 3.0 Cypher 3
Question: I'm trying to add a node to my base, but every time I restart the server, the
node disappears along with their relationships.
I started my base by importing a CSV using the ./neo4j-import script in the
bin folder. The node in question is a node that co... |
Python automatically generating variables
Question: # Question
I have a question about Python creating new variables derived from other
variables. I am struggling to understand how Python automatically knows how to
generate variables even when I do not explicitly tell it to.
# Details
I am a new Python user, and am ... |
Why is idle skipping over f = open('filename' , 'r')
Question: I'm writing a program in python and I am having issues getting idle to read my
file out. If I use improper syntax it tells me, so it is being read by the
compiler but not printing it for the user. Any help would be appreciated. Here
is my code.
... |
My WSGI application cannot be loaded as Python module. What am I doing wrong
Question: I have been trying to get a WebAPI to run on the server. However I keep
getting this error everytime I log into the site via the web browser
> Internal Server Error
>
> The server encountered an internal error or misconfiguration an... |
Django test DB returning nothing
Question: I'm getting the exact same issue as [when does the database is being destroy
in django tests?](http://stackoverflow.com/questions/30232963/when-does-the-
database-is-being-destroy-in-django-tests?rq=1) , where my test DB seems to be
getting deleted between each method. I know ... |
How to randomly choose a string from a list, and insert it into a new one?
Question: I've recently made this program to simulate the concept of random generation
with my example being trees, however I don't understand why I can't find an
element within the list with a randomly generated number. I tried
`Leaves.index()`... |
How to do arithmetic on imported array in python?
Question: I am new to python and only a student so if this question is extremely trivial
I apologize
I've imported a .csv file and indexed 2 columns using panda using the
following:
data_AM = pd.read_csv(name_AM, header = None, names = None, usecols = [2... |
Python3: ftp file upload throws TypeError: Type str doesn't support the buffer API
Question: I'm using python 3.4.2 to upload a logfile to an ftp server (I removed the try
and with statements for simplicity's sake):
import ftplib
ftp = ftplib.FTP(url)
ftp.login(name, password)
ftp.storli... |
Why am I getting TypeError: an integer is required?
Question: This is my code snippet for where the traceback call shows an error:
def categorize(title):
with conn:
cur= conn.cursor()
title_str= str(title)
title_words= re.split('; |, |\*|\n',title_str)
key_l... |
How do I filter incoming data from a socket in Python?
Question: I am using a UDP socket program for one of my projects to read in incoming
data from an EEG headset. I then use this data to control servo motors in a
robotic arm. The code that I am using to create the socket and print out the
data works fine.
... |
How to pass multiple parameters to python function
Question: I have a numpy array with 300 entries. Within each entry is another numpy
array [2048 x 2048].
Each entry is a "tiff" entry (in matrix form) which corresponds to the pixel
position in a detector. Now, what I want to do is centralize this so that I
have an [2... |
python handling DictReader missing keys
Question: This script is working fine, until I hit a cell that is empty:
import csv,time,string,os,requests
dw = "\\\\network\\folder\\btc.csv"
inv_fields = ["id", "rsl", "number", "GP%"]
with open(dw) as infile, open("c:\\upload\\log.csv", "w... |
Confusing error when attempting to start the Jupyter notebook
Question: The following output appeared when I was attempting to start an instance of
the Jupyter botebook:
C:\Users\CaitlinG>jupyter notebook
Traceback (most recent call last):
File "c:\users\caitling\appdata\local\programs\python\p... |
iPython debugger not providing any insight
Question: Let's say I have the following function:
def simple_func():
a = 4
b = 5
c = a * b
print c
Here's what I get when I run `%debug simple_func()`:
NOTE: Enter 'c' at the ipdb> prompt to continue executi... |
python logging - message not showing up in child
Question: I am having some difficulties using python's logging. I have two files,
main.py and mymodule.py. Generally main.py is run, and it will import
mymodule.py and use some functions from there. But sometimes, I will run
mymodule.py directly.
I tried to make it so t... |
z3opt python -- minimizing square
Question: I was considering using z3 to minimize problems involving squares. But when I
write this simple example (z3opt in python 3) :
from z3 import *
a = Real('a')
b = Real('b')
cost = Real('cost')
opt = Optimize()
opt.add(a + b == 3... |
InvalidTemplateLibraryError on initial runserver using wagtail
Question: Everytime i do `python manage.py runserver` an error said
> Invalid template library specified.
>
> ImportError raised when trying to load
> 'wagtail.wagtailcore.templatetags.wagtailcore_tags': cannot import name
> _htmlparser
Answer: There is ... |
How to round a number to n decimal places in Python
Question: I want, what I enter in the entry field should be automatic rounded to n
decimal points.
import Tkinter as Tk
root = Tk.Tk()
class InterfaceApp():
def __init__(self,parent):
self.parent = parent
... |
How can I get to String "no comm" instead of null value using pandas in python ?
Question: How can I get to string "no comm" instead of null value using pandas ?
emp.csv
index empno ename job mgr hiredate sal comm deptno
0, 7839, KING, PRESIDENT, 0, 1981-11-17, 5000, , 10
... |
How to replace keywords in dict values in list of dicts (with case insensitivity)?
Question: I have a list of keywords:
keywords = ["test", "Ok", "great stuff", "PaaS", "mydata"]
And a list of dicts:
statements = [
{"id":"1","text":"Test, this is OK, great stuff, PaaS."},
{"i... |
Uploading a file via pyCurl
Question: I am trying to convert the following curl code into pycurl. I do not want to
use requests. I need to use pycurl because requests is not fully working in my
old python version.
curl
-X POST
-H "Accept-Language: en"
-F "[email protected]"
-F "p... |
Tkinter createfilehandler with socket not working
Question: I found a working example for Tkinter createfilehandler with socket in Chapter
18 from "Python and Tkinter Programming" (of John Grayson) client_server.py
I have tested it on Linux Mint 14.04, with python 2.7.6, and the program seems
to work without errors, b... |
Django - Get item from iterable in django template
Question: When iterating through a list in one of my Django templates, I'm trying to put
in some if logic to say 'if the last items 'type' value is equal to the
current item in the loops 'type' value, but it seems that python syntax for
doing that is not allowed in a D... |
Working with tensorflow's shuffle_batch method
Question: I'm experimenting with [tensorflow](https://www.tensorflow.org/) and I'm
trying to read from a `csv` file and print out a batch of its data via
`shuffle_batch`. I've gone throw the [decode_csv
docs](https://www.tensorflow.org/versions/r0.9/api_docs/python/io_ops.... |
"python myscript" ignores "#!/usr/bin/env pythonX" where pythonX doesn't exist
Question: **Why doesn't`test.py` throw error `env: python3: No such file or directory`
when Python 3 is not installed?**
My system (Mac OS X) has Python 2.7 installed, but not Python 3:
$ /usr/bin/env python -V
Python 2.7... |
Python/Pygame Title Rendering
Question: I'm trying to render a title for a little project I'm working on. I've
replicated the same code which was used to create the options set (merely for
ease) yet it isn't working. I was wondering if anyone knows where I'm going
wrong? it's probably something really obvious but I'm n... |
Creating Grouped bars in Matplotlib
Question: I have just started learning python and I am using the Titanic data set to
practice
I am not able to create a grouped bar chart and it it giving me an error
'incompatible sizes: argument 'height' must be length 2 or scalar'
import numpy as np
import pand... |
How to pass Variable from Python to VBA Sub
Question: I am trying to call a VBA sub from my Python code to convert all excel files
in a specified folder from the xls to xlsm format.
I can use the following code when I am not using a variable in the VBA and it
works well.
**Python Code:**
import os
... |
Python How Can I Make a Counter To Cycle Through a Dictionary Inside a For Loop?
Question: I have just started coding and don't know much about it. This is my bit of
code that tries to cycle through numbers from the for loop to assign num1 and
num2. Instead it make a new one called num0. WHAT?!
import ra... |
Python - Multiprocessing Pool Class: Can the Thread Function contain arguments?
Question: I want to know if it is possible to pass arguments into the threading pool
funktion?
from multiprocessing.dummy import Pool as ThreadPool
def mainFunc():
myArray = ["A", "B", "C"]
pool... |
Python : Most efficient way to get list of combinations?
Question: I have a dictionary :
diff_params = {0: [a, b],
1: [c, d]}
Each key is a setting_name, and each value is a specific setting. I would like
to be able to make a list like:
[[a, c],
[a, d],
... |
Google's Python Course wordcount.py
Question: I am taking Google's Python Course, which uses Python 2.7. I am running 3.5.2.
The script functions. This was one of my exercises.
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.ap... |
Iterate python list and sum equal items
Question: Considering a endpoint on my backend, that returns the following response:
class Arc_Edges_Data(Resource):
def get(self):
#Connect to databse
conn = connectDB()
cur = conn.cursor()
#Perform query and r... |
python regular expression error
Question: I am trying do a pattern search and if match then set a bitarray on the
counter value.
runOutput = device[router].execute (cmd)
runOutput = output.split('\n')
print(runOutput)
for this_line,counter in enumerate(runO... |
How to solve ImportError on import cv2 without uninstalling
Question: I've installed OpenCV3 from source and after running `import cv2` I get the
error:
ImportError: dlopen(/Users/Victor/.virtualenvs/cv/lib/python3.5/cv2.so, 2): Symbol not found: _PyCObject_Type
Referenced from: /Users/Victor/... |
Not loading entire txt file into dictionary
Question: Im a python noob to get that out of the way and I am writing these functions
using the OOP method just a FYI. My save_roster function works correctly, it
saves all of the dictionary player roster to my text file 'roster'. I
confirmed this by looking in the text file... |
Logging to python file doesn't overwrite file when using the mode='w' argument to FileHandler
Question: I have some code to set up a log in Python 2.7 (using the logging module):
import os
import logging
logger=logging.getLogger('CopasiTools')
logger.setLevel(logging.DEBUG)
log_filename=o... |
Removing trailing zero after decimal point in python
Question:
import math
math.floor(85.21)
returns `85.0`
I want to save the number as a file name and I don't want to see the zero! I
would like the output to be `85`
Answer: Then you should consider _casting_ to `int` which does the same thing but
wi... |
Can't import module with importlib.import_module
Question: I want to use `importlib.import_module` to import modules dynamically. My code
like this:
import os
import importlib
os.chdir('D:\\Python27\\Lib\\bsddb')
m = importlib.import_module('db')
print dir(m)
I can to this succ... |
Is it possible to insert import statements with jedi-vim?
Question: I've just started looking at the Vim jedi plugin, and it seems pretty
impressive. One feature of some of the Java IDEs I've used is the ability to
automatically add required imports. Can Jedi do that? For example, if I enter
a line such as
... |
Convert TKinter Into an Exe File
Question: As I was creating a program using python (tkinter), I am unable to convert it
into executable form (`.exe)`.
My program uses several images, a bitmap icon and widgets.
I tried `cx_freeze`. It compiles well and generates `exe` and other files but
doesn't run. I tried `cx_free... |
PHP passthru: unable to get full response from python script
Question: I'm trying to get data from Python script:
import pymorphy2
import json
import sys
morph = pymorphy2.MorphAnalyzer()
butyavka = morph.parse(sys.argv[1])[0]
for item in butyavka.lexeme:
print(item.word)... |
Multilinear maps in python using numpy
Question: In python I have a three dimensional array `T` with size `(n,n,n)`, and a 2-D
array, with size `(n,k)`.
In linear algebra, the multilinear map defined by `T` and applied to `W`, in
code would be:
X3 = np.zeros((k,k,k))
for i in xrange(k):
... |
Should i do math in Django ORM or in Python
Question: I work with Django and have big database with around 30.000 records. My job is
to do some simple math with all of the records. Data in the database is
related to 50 persons. I have to filter rows for each person and then to
calculate the average value for each of th... |
Python script to give input to exe
Question: I am able to open cmd.exe using script
import subprocess
subprocess.call("C:\Windows\System32\cmd.exe",shell=True)
But I am unable to send input command to cmd.exe open. I want to achieve
something like below mentioned using script
1) script give in... |
Python : bad handshake error on get request when executed on windows but not linux
Question: I'm wrote a python script to download the content of a website and it is
working perfectly fine when i execute it on a linux machine, but not on
windows (and it needs to be executed on windows).
Here is the code generating the... |
Problems updating digital clock widget in PyQt4 - calling slot and signal
Question: Ok so this is an edited version of my previous post. I am trying to place a
digital clock onto a home window. I am having difficulty updating the value. I
saw a tutorial
[1](http://codeprogress.com/python/libraries/pyqt/showPyQTExample.... |
Running Flask app from cli gives "no module named flaskr"
Question: I am trying to run the example flaskr app using the Flask 0.11 cli. However, I
get `ImportError: no module named flaskr`. I have set `FLASK_APP` and `import
flaskr` works in a Python shell. How do I run the flaskr app with the cli?
expor... |
Django Will Not Pull CSS Static File (404 Error) Even Though File Paths Look Correct
Question: When I load my local site I cannot get the CSS files to load. I'm running
Django 1.9 and python 3.4.2.
Here is my structure:
apps/
app1/
app2/
etc.
clients/
media/ #css, js,... |
What does !r do in str() and repr()?
Question: According to the [Python 2.7.12
documentation](https://docs.python.org/2/tutorial/inputoutput.html#fancier-
output-formatting):
> `!s` (apply `str()`) and `!r` (apply `repr()`) can be used to convert the
> value before it is formatted.
>
>
> >>> import math
> ... |
Generate unique non repeating pairs in a list in O(n)
Question: How do we generate unique non repeating pairs such that (x,y) = (y,x) are not
repeated.
Say we have a list `[3,6,9]`. Then, answer is `(3, 6) (3, 9) (6, 9)` If the
list is `[3,6]`. Then answer is `(3,6)`
This can be done using 2 for loops, but we want to... |
(fields.E331) Field specifies a many-to-many relation through model 'models_groups', which has not been installed
Question: > ERRORS: login.Freelancer.groups: (fields.E331) Field specifies a many-to-
> many relation through model 'login.Freelancer_groups', which has not been
> installed. login.Freelancer.user_permissio... |
Ordering a GROUP BY query
Question: I'm using sqlite3 database in my very simple program written in python. Table
I have a problem with contains three columns:
id, software_version, place
Now I would like to count the frequency of a particular software version, so I
created this query:
... |
Discrepancy between formatted numeric value and rounded value
Question: I found this weird behavior using python and numpy:
print('%10.3f' %0.4975)
returns 0.497, while
numpy.round(0.4975,3)
returns 0.498 as expected. With other similar numbers I always get the print
statement ... |
Unable to login to Github or Facebook or any such site using Python requests?
Question: I am using the following code:
import requests
s = requests.session()
login_data = dict(login='username', password='my_password')
s.post('https://github.com/login/', data=login_data)
r = s.ge... |
Can someone explain this bitwise array-wrap-around expression?
Question: I've been researching on the Diamond-square algorithm and I came across [this
website](http://www.bluh.org/code-the-diamond-square-algorithm/) which pointed
me to the source code of Notch's Minicraft, and does a conversion of the
algorithm as was ... |
Automated filling of web form from a list in Python using Selenium
Question: This is the Selenium code in Python "sel.py" :-
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('http://127.0.0.1:8000/employee/register/')
employes = ['1', '2016-1-1', 'Tarun', '... |
'u' at the beginning of output (Sqlite, Python)
Question: I'm really confused about the sqlite part, where I print out my database,
because I keep getting an 'u' at the beginning of every line, it doesn't have
' ' around though, which I assume is not accepted as a string? This only
happens on this one programme (I test... |
add labels to sklearn k-means
Question: I am trying to use kmeans in python.
data = [[1,2,3,4,5],[1,0,3,2,4],[4,3,234,5,5],[23,4,5,1,4],[23,5,2,3,5]]
Each of this data have a label. Example:
[1,2,3,4,5] -> Fiat1
[1,0,3,2,4] -> Fiat2
[4,3,234,5,5] -> Mercedes
[23,4,5,1,4] ... |
Expand macros & retrieve macro values
Question: I am trying to use **libclang** python bindings to parse my c++ source files.
I am unable to get the value of macro or expand a macro.
Here is my sample c++ code
#define FOO 6001
#define EXPAND_MACR \
int \
foo = 61
int mai... |
List of tuple like independent data access
Question: I have some paired objects linked together in a same level priority basis.
They can be grouped as fixed length tuples, all have to be in a list. Some
objects type are unique, other can be common). For example, in this data
structure i have an object, an object name (... |
Error installing quandl with pip on ubuntu 14.04
Question: here is the error that I keep getting. I keep trying to install the quandl
modulen and keep running into this same error. I have tried looking into some
other questions but they do not provide any good solutions. I tried looking
through the errors but I already... |
Python Error Calling Function Within Function
Question: I am a novice in python. I just extended the Hello World program:
import sys
def first(n):
print "Hi Man"+" Huuuuuu"
if len(sys.argv)>1: print sys.argv[1]
def second():
print "Huuuuuuuuuuu"
first... |
How to omitt newlines in Phython?
Question: I know..... one way to omitting new lines in Python with concatenation:
a = 'strin'
b = 2
print str(b)+a
how many ways we can this be done?
Answer: I believe, you are using Python2.x. You can try following:
1. use a trailing comma.
... |
Environmental variables from .env file not available during local migrations in django, heroku
Question: I have been developing on Heroku, using the `config` variables to store
sensitive and other environmental variables. While developing locally, I have
mirrored these variables in the `.env` file.
What I am finding n... |
Django nose giving "ImportError: cannot import name setup"?
Question: Django-nose installed in virtualenv is giving "ImportError: cannot import name
setup" in runner.py when I run default server. On doing traceback I get this:
File "/home/sid/.virtualenvs/workbench/local/lib/python2.7/site-packages/djang... |
python pandas merge/vlookup tables
Question: I was writing the Python code below to merge two tables, which could be done
in Excel using Vlookup, but wanted to automate this process for a larger data
set. However, it seems the output data is too big and contains all columns
from both tables. I just wanted to use the se... |
Python SQLAlchemy - Error IM001 reflecting table
Question: first of all, sorry if I'm not writing in the right place or I'm not providing
enough info about the issue.
Using SQL Alchemy, with pyodbc. I'm trying to reflect a table. When I try to
do that, i get this message
> DBAPIError: (pyodbc.Error) ('IM001', '[IM001... |
Python, best way to find out location of a color
Question: A black and white image showing a smile face inside a frame.
[](http://i.stack.imgur.com/sbqcu.jpg)
What I want is to find out the location of most right point of the smile face.
(in this case... |
Convert python timezone aware datetime string to utc time
Question: I have a Python datetime string that is timezone aware and need to convert it
to UTC timestamp.
'2016-07-15T10:00:00-06:00'
Most of the SO links talks about getting the current datetime in UTC but not
on converting the given dateti... |
Check if Python (3.4) Tkinter Entry is Full
Question: I am using a standard tkinter entry to input a directory path. When the user
presses enter - if the physical length of the string exceeds that of the
entry, I want the program to modify the displayed text to ...[end of
directory]. I have the logistics of this figure... |
Error converting GUI to standalone executable using Py2exe
Question: I am using `py2exe` to convert my program with multiple GUIs to a standalone
executable. I used PyQt to create the GUIs. The main script I run instantiates
the main UI, which contains buttons, tabs, etc. that can open sub-UIs. The
main script is `main... |
How to parse only specific tag values
Question: I'm new to Python, and i've written some code for parsing data from the [ESPN
site](http://espn.go.com/nhl/statistics/player/_/stat/points/sort/points/year/2015/seasontype/2)!
#importing packages/modules
from bs4 import BeautifulSoup
import pandas a... |
None column in csv (csv python module)
Question: An instrument create a CVS with this on the file header :
XLabel,Wavenumber
YLabel,Response
FileType,Single Beam
DisplayDirection,20300
PeakDirection,20312
0.000000,-1.149420,-1.177183,-1.174535
0.964406,-1.053002,-1.083787,-1.06991... |
Python search and replace
Question: I have written two functions in Python. When I run replace(), it looks at the
data structure named replacements. It takes the key, iterates through the
document and when it matches a key to a word in the document, it replaces the
word with the value.
Now it seems what is happening, ... |
Cannot import pandas after pip install pandas
Question: I run the following command to install `pandas` via `pip`:
sudo pip install pandas --upgrade
which outputs
Requirement already up-to-date: pandas in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-... |
Reverse for 'post_new' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Question: I get this traceback when browsing to <https://monajalal.pythonanywhere.com/>
and the complete code can be found here
<https://github.com/monajalal/FirstDjangoApp> :
NoReverseMatch at /
R... |
Couldn't run the python application based on TKinter
Question:
import Tkinter as tk
from functools import partial
pad = [[1, 2, 3], [4, 5, 6], [7, 8, 9], ["C", 0, "S"]]
passcode = ""
def append_passcode(value):
global passcode
if len(passcode) == 4:
passcode = ... |
Compare adjacent values in numpy array
Question: I have a Numpy one-dimensional array of data, something like this
a = [1.9, 2.3, 2.1, 2.5, 2.7, 3.0, 3.3, 3.2, 3.1]
I want to create a new array, where the values are composed of the greater of
the adjacent values. For the above example, the output w... |
File does not upload and save in the database
Question: I've been having problem in saving and uploading files in django. I've been
reading the entire tutorial to get this up and running. I've been stuck with
this:
'tuple' does not support the buffer interface
The problem seems to be coming from vi... |
How to plot a Python Dataframe with category values like this picture?
Question: 
How can I achieve that using matplotlib?
Answer: Here is my code with the data you provided. As there's no class [they are all
different, despite your first example in ... |
Python, Tk and OptionMenu: how to sort a drop down list?
Question: I want to make a drop down list with tk and OptionMenu. I want to show a
string to the user ("10 us", "40 us"...) and return a number (0, 1,...) which
is a parameter that I send to a variable. It works well, but it's not sorted.
I want to sort the list ... |
SwiftConfigurationException: Invalid host name when accessing Swift from Bluemix Spark
Question: I've stored a file in Swift (Bluemix Objectstore) and I'm trying to access it
from a Python application running on Spark within Bluemix.
I can successfully access the file in a Python notebook running in the same
environme... |
getting the average of serial port data
Question: i have a python code which reads serial data through RS232
import serial
import time
ser = serial.Serial('/dev/ttyUSB0', 2400, timeout=1)
while True:
str1 = ser.read(1)
if str1 == '':
print 'no data on line'
else:... |
Zipline: using pandas-datareader to feed in Google Finance dataframe for non-US based financial markets
Question: **PLEASE NOTE:** This question was successfully answered ptrj below. I have
also written a blog post on my blog about my experiences with zipline which
you can find here: <https://financialzipline.wordpress... |
Python - Transposing a list (rows with different length) using numpy fails
Question: When the list contains only rows with same length the transposition works:
numpy.array([[1, 2], [3, 4]]).T.tolist();
>>> [[1, 3], [2, 4]]
But, in my case the list contains rows with different length:
... |
moving a file in python using shutil
Question: I know there have been some posts on how to move a file in python but I am a
little confused. I am working on a program that has a file called test.txt
The file path is this: `C:\Users\user\Desktop\Project1\Project1`
I want to move it to: `C:\Users\user\Documents\Projec... |
Why does sorted()'s key parameter require a keyword argument
Question: If you inspect the signature of Python's built-in `sorted()` function like
this:
import inspect
print(inspect.signature(sorted))
The signature is: `(iterable, key=None, reverse=False)`.
Based on my understanding of position... |
Looking for a way to de-reference a bash var wrapped in a python command call
Question: I'm trying to find a way to de-reference goldenClusterID to use it in an AWS
CLI command to terminate my cluster. This program is to compensate for dynamic
Job-Flow Numbers generated each day so normal Data Pipeline shutdown via
sch... |
Tweepy: can´t print tweets in file
Question: I'm new to python (and programming in general) and I'm trying to write a
script to collect tweets. I can´t get the script to print the tweets in the
file. The tweets appeared in Idle with the error "failed ondata, global name
'saveFile' is not defined" and they don't get pri... |
Realtime plotting with PyQt PlotWidget - error message PlotWidget object is not callable
Question: I am trying to create a real time data plot using a PyQt plot widget. I read
that PyQt is the best option for plotting real time graphs but so far I am not
having any success.
I have tried to plot random data using the m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.