text
stringlengths
226
34.5k
Alternatives to python griddata Question: I am using griddata to resample a numpy 2 dimensional array on a grid. z.shape = (1000, 1000) x, y = np.arange(-5, 5, 0.01), np.arange(-5, 5, 0.01) newx, newy = np.arange(-2, 2, 0.1), np.arange(-2, 2, 0.1) griddata((x, y), z, (newx[None, :], newy...
PyRO 4 - lookup fails when I try to find a registered object Question: I'm fighting against this problem for about a week, and I don't know anymore where to look to find a solution. As the title says, as soon as I successfully register a pyro object, I try to find it on the NS, in order to operate with it, but the loo...
Insert figure into iPython markdown cell Question: In iPython I create an image in one cell using the Pandas plot function. In a different markdown cell in the same notebook I would like to add this figure inline. Is it possible to reference notebook internal figures in a markdown cell without saving them to disk? A...
Pool.map - Why doesn't the worker process crash earlier? Question: Say I do this: import multiprocessing as mp def f(x): raise OverflowError # raised BEFORE the print print x if __name__ == '__main__': pool = mp.Pool(processes=1) for _ in pool.imap_unord...
Python sees uninstalled module Question: I have a really weird problem. I'm developing a Pyramid project and it seems like **non-existing** module is found when I run `pserve`. `__init__.py` of my main module: ... # This works !!! db/models directory does not even exists from db.models import Ba...
create sublists within sublists in python Question: I'd like to create a series of sublists within a sublist: original = range(1,13) I read another post that provided a solution to create sublists within a list: >>> [original[i:i+2] for i in range(0,len(original),2)] >>> [[1,2], ...
Python, Tkinter, Subprocess- getting stdout and inserting it to Text Question: Have mercy, I'm a beginner. I'm trying to write a very basic application to run 'chkdsk c:' and print out the output to a text box line by line. for each line I want a ttk.Progressbar to move a bit. I've seen similar questions answered here...
Minimize objective function using limfit.minimize in Python Question: I am having a problem with package `lmfit.minimize` minimization procedure. Actually, I could not create a correct objective function for my problem. **Problem definition** * My function: `yn = a_11*x1**2 + a_12*x2**2 + ... + a_m*xn**2`,where `xn...
How run cherrypy app without screen logging? Question: Hi I looking for some configuration or flag that allows me to silence the requested pages. When I run `python cherrypy_app.py` and I join to the `127.0.0.1:8080` in the console where I start the cherrypy app show me `127.0.0.1 - - [09/Oct/2014:19:10:35] "GET / HT...
Writing a Array of Dictionaries to CSV Question: I'm trying to get the dictionary (which the first part of the program generates) to write to a csv so that I can perform further operations on the data in excel. I realize the code isn't efficient but at this point I'd just like it to work. I can deal with speeding it up...
Euler-Cromer ODE Python Routine Question: I am using an Euler-Cromer scheme to calculate the position and velocity of Halley's comet. The script tries several values for a time-step (tau) for each value of initial velocity in a range. For each tau value, it runs through the Euler-Cromer routine and compares the total m...
Writing to a uWSGI unix socket Question: I have a Python wsgi app that is served by uWSGI behind NGinx. NGinx listens on the network and forwards requests to the uWSGI unix socket located in `/tmp/uwsgi.socket`. Now, I'm trying to emulate what I'm speculating NGinx does when talking to this socket. I've tried the foll...
how to cast a variable in xpath python Question: from lxml import html import requests pagina = 'http://www.beleggen.nl/amx' page = requests.get(pagina) tree = html.fromstring(page.text) aandeel = tree.xpath('//a[@title="Imtech"]/text()') print aandeel This part works, but I...
How to deal with 401 (unauthorised) in python requests Question: What I want to do is GET from a site and if that request returns a 401, then redo my authentication wiggle (which may be out of date) and try again. But I don't want to try a third time, since that would be my authentication wiggle having the wrong creden...
Python pandas Reading specific values from HDF5 files using read_hdf and HDFStore.select Question: So I created hdf5 file with a simple dataset that looks like this >>> pd.read_hdf('STORAGE2.h5', 'table') A B 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 Using this script ...
Python filename change Question: I have a number of videos in a directory on my Mac that all have a specific string in the file name that I want to remove, but I want to keep the rest of the file name as it is. I'm running this python script from terminal. I have this syntax but it doesn't seem to work. Is it practica...
How to write the follwing in list comprehension in python Question: Can I write the following in list comprehension way in python for row in candidates: sum=0 for i in range(1,len(candidates)): if(row[i]!='NA') sum+=int(row[i]) row.append(sum) Her...
plotting datetime object in matplotlib Question: I have an array of datetime objects that is the following dates = [datetime.datetime(1900, 1, 1, 10, 8, 14, 565000), datetime.datetime(1900, 1, 1, 10, 8, 35, 330000), datetime.datetime(1900, 1, 1, 10, 8, 43, 358000), datetime.datetime(1900, 1, 1, 10, 8, 52...
Heroku push rejected - failed to compile - Unicode error Question: I'm new to Flask and Heroku, so to try it out, I wrote a little app that works fine when I run it locally using `foreman start`. However, when I try to `git push heroku master`, I get the following error: ---------------------------------...
Remove duplicate url's python Question: I want to remove the duplicate url's from the file having list of url's. My bugun_url_given.txt has "<http://www.bugun.com.tr/ara/Ak%20Parti/1>" and it fetches all the url's and they are repeating.. It saves all the unique url's in "bugun_url_collection.tx" here is my code: ...
How do I make a histogram from a csv file which contains a single column of numbers in python? Question: I have a csv file (excel spreadsheet) of a column of roughly a million numbers. I want to make a histogram of this data with the frequency of the numbers on the y-axis and the number quantities on the x-axis. I know...
AttributeError: 'str' object has no attribute 'policy' Question: I am new to Python. I am trying to make an email script that can send an email. First, I made a Python script without any classes, just function just to make sure that the script runs as expected. After I got the expected result. I am trying to rewrite th...
modify qscintilla python lexar Question: Similar to this question: [Creating and colorizing new constructs on a existing Scintilla lexer](http://stackoverflow.com/questions/22021294/creating-and-colorizing- new-constructs-on-a-existing-scintilla-lexer) but instead of adding, I would like to modify text colors of the le...
What exactly does Spyder do to Unicode strings? Question: Running Python in a standard GNU terminal emulator on Ubuntu 14.04, I get the expected behavior when typing interactively: >>> len('tiθ') 4 >>> len(u'tiθ') 3 The same thing happens when running an explicitly utf8-encoded script i...
Find if 24 hrs have passed between datetimes - Python Question: I have the following method: # last_updated is a datetime() object, representing the last time this program ran def time_diff(last_updated): day_period = last_updated.replace(day=last_updated.day+1, hour=1, ...
Python: To get proper attribute / function name for dynamically added functions Question: Below is the sample code. import inspect from types import MethodType class Settings(object): APPS = ['s1', 's2', 's3'] def __init__(self): Settings._setup_apps(self) ...
Filtering null values from keys of dictionary- Python Question: I have a pandas data frame and created a dictionary based on columns of the data frame. The dictionary is almost well generated but the only problem is that I try to filter out the NaN value but my code doesn't work, so there are NaN as key in the dictiona...
Compiling *.py files Question: I'm trying to compile python source files without success. According to [documentation](https://docs.python.org/3.2/library/compileall.html), **compileall.compile_dir** function has "**ddir** " parameter, which (I guess) specifies the destination folder for .pyc files. I try to compile it...
Buildout installs django but can't import Question: Here's my buildout.cfg: [buildout] parts = django [versions] djangorecipe = 1.5 django = 1.7 [django] recipe = djangorecipe project = timetable eggs = Here's my routine for setting up project in a...
How to use Hacker News API in Python? Question: Hacker News has released an API, how do I use it in Python? I want get all the top posts. I tried using `urllib`, but I don't think I am doing right. here's my code: import urllib2 response = urllib2.urlopen('https://hacker-news.firebaseio.com/v0/tops...
importer which imports .py files only Question: I need a Python <http://legacy.python.org/dev/peps/pep-0302/> finder and importer class which works on a specific directory, but it can load only `.py` files (i.e. no `.so`, no `.dll`, no `.pyc`). The specified directory contains several packages (with `__path__` specifi...
How do I flush a graphics figure from matplotlib.pylab when inside a file input loop? Question: I am using Python 2.7 and importing libraries numpy and matplotlib. I want to read multiple file names of tab-delimited text files (time, voltage and pressure measurements) and after each one display the corresponding graph ...
python script and libGLEW related error (menpo.io API) Question: I am writing a python script in Ubuntu 14.04 that imports the menpo.io (API for deformable models) that results in the following error: Traceback (most recent call last): File "/home/xsmailis/Dropbox/pyFaceDepression/AAM_Menpo_final.p...
Python3 "magic functions" stack trace Question: I find myself in a situation where I am redefining a lot of the so called "magic" attributes or functions of my class in Python3 (`__add__`, `__sub__`, etc.) For all of these, I implement the same two lines of code: arg1 = self.decimal if isinstance(self, ...
Browser Crashes in Page Retrieving Loop, Python Selenium Script Question: I wrote this simple script - it simply fetches an image from blogposts and posts it to Pinterest. It works great, except that after about 43 pages, the browser hangs/freezes. I'm wondering if there is some sort of "leak" causing things to get ou...
Python Lex-Yacc (PLY) Error recovery at the end of input Question: ## Problem I am trying to implement an error tolerant parser using Python Lex-Yacc (PLY), but I have trouble using error recovery rules at the end of my input string. How can I recover from an unexpected end of input? ## Example This example grammar...
PyCharm: python build-in exceptions unresolved Question: I have a working Django PyCharm 3.4.1 project which i have been working on for month without problems! But now PyCharm _for some reason marks all python build-in exceptions as unresolved_. Other Features like code completion and debugging remain to work fine. #...
Logging at Gevent application Question: I'm trying to use standard Python logging module alongside with gevent. I have monkey patched threading and I expect logging to work with my app: import gevent.monkey gevent.monkey.patch_all() import logging logger = logging.getLogger() fh...
Recording the time into a text file Question: I am trying to test how long my battery runs on my raspberry pi. All i need to do is run a while loop until the battery dies. However, I need to record the time that it starts and ends. I would like to save the data into a txt file. My current code is as follows: ...
Read/Write Sequence Files Containing Thrift Records Using Hadoop Streaming with Python Question: I would like to Read/Write sequence files containing Thrift records using Hadoop Streaming with Python. I have looked at the following and its seems this is possible after HADOOP-1722 but if someone has done this already an...
How to convert list of dictionary values in python to a string and write on seprate cells of a csv file? Question: I want to write a dictionary on a csv file in Python. I want the output to be like this: key1 key2 4 3 2 1 3 but the output is like this: ...
Checking file header, signature and type Question: I am making a file type checking program (with file signature checking) but, there are so many file signatures, so I can't compare object file with file signature. Is there any library checking file signatures, or how can I easily make this script? How can I make one ...
Add enviroment variable for python with batch Question: ## **Short question:** How would I append a environment python variable with a bath script? I want do the equal to: `import sys sys.path.append('E:\whatever\locallyScriptFolder')` but with a batch file? I'm a batch noob. ## **Longer pipeline question:** I need ...
Can't pip install anything requiring C compilation on OSX 10.10 with homebrew python Question: When I try to `pip install` things that involve C compilation (`Pillow`, specifically) I get an odd error: clang: error: no such file or directory: 'Python.framework/Versions/2.7/Python' error: command...
Python How to copy value from an Entry field to a Text field in Tkinter Question: I’m trying to make a simple GUI with Tkinker that when you press a button it adds the value in the Entry field to the next row in the Text field. from tkinter import * #def onclick(): # pass class My...
Getting the name of file download using selenium in python Question: So I'm downloading a file using Selenium and it works fine but I need to get the name of the file. My variable `path` should get the name of what was downloaded but all it prints out is "none". driver = webdriver.Firefox(firefox_profil...
Capture group via regex; then run a different regex on captured group Question: I have a log file that's filled with run time information for a program. If it fails it generates a typical python stacktrace. I'd like to extract the whole stack trace, trigged by 'Traceback (most recent call last):' into a regex group, a...
Parsing Serialized Java objects in Python Question: The string at the bottom of this post is the serialization of a `java.util.GregorianCalendar` object in Java. I am hoping to parse it in Python. I figured I could approach this problem with a combination of regexps and `key=val` splitting, i.e. something along the li...
Can't install lxml in python2.7 Question: Im trying to install lxml within a virtualenv with `sudo pip install lxml` and also `sudo pip install --upgrade lxml` but getting the following in both cases: x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z, relro -fno-strict-ali...
MySQL Connector in Python Question: Trying to connect to my MySQL DB on my VPS. I'm getting the following error, when using the below code; (I've stripped out my credentials - however I know they work, as I use them for my PHP dev as well. **CODE** import mysql.connector as mysql from mysql.connect...
What is the best way to convert raw binary data to a custom base in python? Question: I need to convert some data to base 29 before processing and I'm using this: import string def datatobase(data, base): digs = string.digits + string.lowercase + string.uppercase if base > len(di...
python does not find wxPython Question: In order to start building a gui I've decided to install wxPython, however I can't get it working. I run python 2.7.6 (in IDLE it shows: Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32) and it works fine. When I however try to install a 32 bit ...
Want to pull a journal title from an RCSB Page using python & BeautifulSoup Question: I am trying to get specific information about the original citing paper in the Protein Data Bank given only the 4 letter PDBID of the protein. To do this I am using the python libraries requests and BeautifulSoup. To try and build th...
Fast 3D matrix re-slicing Question: I have a 3D matrix of size _(X, Y, Z)_ which is stored in a data structure as _Z_ matrices, each _X x Y_ in size. I would like to re-slice these matrices to obtain _X_ slices, each _Y x Z_ in size. In other words, I want to reslice a 3D matrix stored as XY slices in the YZ plane. The...
Create Job using Rundeckrun? Question: Want to create a job using rundeckrun python module in Rundeck, I searched in their documentation, but couldn't find it. Is there any other option to create a job using rundeckrun in Rundeck Thanks for your attention. Answer: This was recently posted in the rundeckrun repo: [#...
Executing a Postgresql query in Python that creates a table Question: I'm creating a Flask webapp that displays the results of various Postgresql queries. As part of the initialization, I want to run a query that creates a table in Postgresql containing all of the data that I will need for subsequent queries. My proble...
Apache mod_wsgi and Qt Question: I'm getting an error in Apache error_log with WSGI and PyQt4 : : cannot connect to X server My Python code looks like : import PyQt4.qtgui as qtgui __qt_app = qtgui.QApplication([]) I had a minimal CentOS installation and I had to install li...
skimage's rgb2gray in python: AttributeError: Nonetype object has no attribute ndim Question: I was using this code (with skimage version 0.10.0) as far as I can remember without issues: from scipy import misc import scipy.io as sio from skimage.color import rgb2gray img = cv2.imread(myf...
how to use python to parse ossec rules xml Question: I have a ossec rules XML file, with content like this: <var name="SENSITIVE_DIRECTORY">^/root|^/proc|^/etc|^/$</var> <var name="BAD_WORDS_OPS">failure|error|bad |fatal|failed|illegal |denied|refused|unauthorized</var> <group name="local,op...
How to define General deterministic function in PyMC Question: In my model, I need to obtain the value of my deterministic variable from a set of parent variables using a complicated python function. Is it possible to do that? Following is a pyMC3 code which shows what I am trying to do in a simplified case. ...
Sympy issue with solving equation from stated conditions Question: Hello I'm quite new to python and I'm trying to solve a set of equations with an unknown variable, the equations are in the code below from __future__ import division import sympy as sy import math #Global Variables indepeneda...
ffmpeg in the use of libardrone by python Question: Recently I am trying to do a vision-based control using AR.drone 2.0. I meet a problem in the first step that is to import video seen from drone to my PC. I searched online and there is a library called [libardrone](https://github.com/braincorp/robustus-test-repo). I ...
python filter rewrite filter Question: Working code def not_double_cap_word(word): cap_count = 0 for ch in word: if str.isupper(ch): cap_count += 1 not_double_cap = (cap_count < 2) return not_double_cap ... words_no_double_...
python 3 iterator not executing next Question: Why does an iterator in python 3 support `__next__` and not `next`? Is it not supposed to be called directly but only while doing : for i in iterator: dosomething(i) I have a use case where I would like to call `next`. For example using `ite...
Python program, user friendly query Question: I saw your bit explaining how to import these things and generate a random number using them but can you solve this problem. This is (the starting stages of) my program: import random from operator import add, sub, mul for x in range(10): ops ...
Running PHP Selenium Webdriver tests programmatically, without phpunit command Question: My question is quite simple. I'm coming from Python world, where it's very simple to execute Selenium testing code within a program, just writing something like: from selenium import webdriver driver = webdr...
re: matching 'a href' tag Question: I have this simple program that takes in a file from stdin and output only the host (example: returning only HOST. Except when I run cat sample.html | python program.py right now it outputs _href"=google.com_ I want it to remove the _'href="_ part and have it only output google.com...
How to exit from Python using a Tkinter Button? Question: To start off, let me show you my code: import Tkinter import tkMessageBox import time import sys def endProgam(): raise SystemExit sys.exit() top = Tkinter.Tk() B = Tkinter.Button(top, text = "Hell...
Python - "random" error Question: I am writing a code in Python 3.3.3 that makes a list of 32 teams if you enter say 12 and makes sure that the team that is repeated the most is only repeated once more than that which is being repeated the least. If have done this: import random teams =[] ...
Creating and maintaining MongoDB replica sets with pymongo Question: I am trying to replicate (for a teaching activity) the [Docker and MongoDB Sharded Cluster](https://sebastianvoss.com/docker-mongodb-sharded- cluster.html) recipe in an IPython notebook using _pymongo_ to set up several mongo replica sets. The recipe...
Python: Join lists of lists by the first element Question: I'm trying to combine a list of lists/tuples by the first element in the list - something like this: Input: [(1, [32, 432, 54]), (1, [43, 54, 65]), (2, [2, 43, 54]), (2, [1, 5, 6])] Output: [(1, [32, 432, 54], [43, 54, 65]),...
New Django App MEDIA_URL pathing incorrect Question: So, I've created a new app in Django via `python manage.py startapp foo` My new app will not load any files in the `/site_media/` directory, via the `{{ MEDIA_URL }}`. They are attempting to path from the App's directory, not the `/site_media/` directory. * * * **...
Why does padding an FFT in NumPy make it run much slower? Question: I had writted a script using NumPy's `fft` function, where I was padding my input array to the nearest power of 2 to get a faster FFT. After profiling the code, I found that the FFT call was taking the longest time, so I fiddled around with the parame...
Plot linear model in 3d with Matplotlib Question: I'm trying to create a 3d plot of a linear model fit for a data set. I was able to do this relatively easily in R, but I'm really struggling to do the same in Python. Here is what I've done in R: ![3d plot](http://i.stack.imgur.com/etOb8.png) Here's what I've done in ...
Mocking Directory Structure in Python Question: I have some code below that I'm using to take an input of files, open and process, and then output some data. I've gotten the functionality working and I'm unit testing it now, below is an example of the code. def foo(dir): path_to_search = join(dir...
why does pymongo's find_one fail silently? (nginx/uwsgi/flask/gevent/pymongo) Question: **Summary:** Pymongo appears to fail silently for no reason in my flask+gevent+uwsgi+nginx app. I would love some pointers on where I should look I'm a newcomer to web application programming (and to python), please bear with me. I...
Python Lirc blocks code even when blocking is off Question: I'm trying to set up a scrolling weather feed using the **OWN (Open Weather Network**)on my **Raspberry Pi B+** running the latest **Rasbian Wheezy** distro and I'm having trouble adding IR support using **Python LIRC (Linux Infrared Remote Control)**. **_Wha...
Using zxJDBC with jython not working Question: since I wanted to transform data storage for my recent Minecraft Python/Jython Bukkit plugins from flat file to MySQL database I started googling. Tried sqlite3 and MySQLd for Python but without success, so after few hours of searching StackOverflow I came up to this quest...
Predict interesting articles with scikit-learn Question: I'm trying to build an algorithm capable of predicting if I will like an article, based on the previous articles I liked. Example: * I read 50 articles, I liked 10. I tell my program I liked them. * Then 20 new articles are coming. My program has to give me...
Python, Django with PyCharm. Message error: "No module named M2Crypto" How resolve? Question: I received this message: "No module named M2Crypto" I have already install M2Crypto with the command "pip install M2Crypto" and when I re-run it, I got the message: "Requirement already satisfied" What's the problem with M2Cr...
Hierarchical Clustering Dendrogram using python Question: Graph theory and Data mining are two fields of computer science I'm still new at, so excuse my basic understanding. I have been asked to plot a Dendrogram of a hierarchically clustered graph. The input I have been given is the following : a list of all the edge...
Python: Running multiple timers simultaneously Question: I want to create multiple timers in a loop. When the loop terminates, there should be multiple timers running. If any of the timers times out, it should call another function. How do I implement this in Python? Any help will be appreciated. eg. fo...
Resume an Iterator Question: Is there a way to resume an iterator after a keyboard interrupt signal or other SIGINT signal in python? Specifically for itertools iterator `import itertools for word in itertools.product("abcd",repeat=3): print(word)` I want to resume printing from where it left off Answer: You can c...
Trying to multiprocess a function requiring a list argument in python Question: My problem is that I'm trying to pass a `list` as a variable to a function, and I'd like to mutlti-thread the function processing. I can't seem to use `pool.map` because it only accepts iterables. I can't seem to use `pool.apply` because it...
PolynomialFeatures fit_transform is giving Value error Question: I am getting a ValueError while trying to run the Polynomial Regression example: from sklearn.preprocessing import PolynomialFeatures import numpy as np poly = PolynomialFeatures(degree=2) poly.fit_transform(X) ==> ERROR ...
Python memory management with a median image stacker Question: I've been playing with time-lapse photography lately, and using median image stacking on a group of images, or extracted video frames. I've created a little script that works well with a relative few images: from PIL import Image import o...
"no control matching name" in mechanize for python Question: I am using mechanize for python and I am trying to search for an item in kijiji. Eventually my goal is for my program to search for an item, and using beautifulsoup, check whether or not someone has posted a new ad for my search term by scraping through the h...
My first unit test, what am I doing wrong? Question: This is my first time trying to write a test and I'm guessing I made some obvious screw up with writing the test itself. Here is my test: from django.test import TestCase from accounts.forms import UserReview class MyTests(TestCase):...
py2exe cannot import from six.py Question: I'm trying use py2exe on a program that imports `urlparse` from `six.moves.urllib_parse`. Here is the program: # hello.py from six.moves.urllib_parse import urlparse print('hello world') And here is my setup.py: from distutils.core i...
how to avoid IOError while looping through a long list that opens many files in threads? Question: I'm downloading access logs from Amazon S3. These are A LOT of small files. To reduce the time of download, I've decided to read each file in a thread. This is my main method that first connects to S3, then iterates over...
Python Function to test ping Question: I'm trying to create a function that I can call on a timed basis to check for good ping and return the result so I can update the on-screen display. I am new to python so I don't fully understand how to return a value or set a variable in a function. Here is my code that works: ...
How to output a file where named entities are replaced by tags using Stanford CoreNLP in Python? Question: I'm working with Stanford NLP using Python. So, I have a function that inputs some text files and converts them to xml files(generated by Stanford CoreNLP). Now, I want to write another function that inputs these ...
Seasonal Decomposition of Time Series by Loess with Python Question: I'm trying to do with Python what I the STL function on R. The R commands are fit <- stl(elecequip, s.window=5) plot(fit) How do I do this in Python? I investigated that statmodels.tsa has some time series analysis functions ...
Obtain text from lxml Comment Question: I am trying to get the content of the `_Comment`. I've researched quite a bit on how do do it, but I don't know how to access the function from the `td` element in order to grab the text. I'm using xpaths with the python Scrapy module if that helps. td = None [_Ele...
Can not load jQuery DataTables plugin in IPython Notebook Question: I'm attempting to use the jQuery DataTables plugin within an IPython Notebook. For some reason, the plugin doesn't seem to be applied to the jQuery instance. The code below demonstrates the problem. When I execute this, I get an error of "[Error] TypeE...
Python: How to download a webfile into the memory? Question: [In order to open the example urls you need to login to Shazam] So I'm writing a script that downloads my Shazam history so I can then manipulate it to write playlists to other services. Anyways, I can't directly parse the history from <http://www.shazam.com...
Create new line based on each regex match in python Question: I have an input file that contains data formatted as follows: a; b, c| derp derp "X1234567, Y1234567, Z1234567" derp derp a; b, c| I would like to use Python to parse that into multiple lines for each item that occurs between double quotes. The output for...
python search a string in a text file and copy a block Question: I have this text file names.txt Daniel Sam Sameer Code Print Alpha Bravo Charlie and I want to search it for string "Alpha" and copy the line "alpha" and the previous 100 lines then write"append" it to file...
Python gspread login error 10060 Question: I am attempting to log in to my Google account with gspread. However, it just times out with a `Socket Errno 10060`. I have already activated POP and IMAP access on my email. import gspread print 1 gc = gspread.Client(auth=('***@gmail.com', '*****')) ...
Converting LinearSVC's decision function to probabilities (Scikit learn python ) Question: I use linear SVM from scikit learn (LinearSVC) for binary classification problem. I understand that LinearSVC can give me the predicted labels, and the decision scores but I wanted probability estimates (confidence in the label)....