Interesting Tags
   11 tags on

0 answers

How to insert a row and a column in a recursive table

I'm posting this question because I've tried over and over without results. I have written a table that prints in the shell of Python 2.7 and exports to CSV the inputs given in a nested for loop. I'm ...

2 answers

Appending arrays by array names

I am working with a function which outputs a numpy array around 600 elements long. array = function_output() array.shape # this outputs (600,) I have to work with around 50 outputs this function. ...

2 answers | 2 mins ago by ShanZhengYang on Stack Overflow
0 answers

Trying to save pages that contain only specific keyword

Please do not flag this to my previous questions, as I have resolved many issues there, but one remains. I'm trying to save the pages that are crawled with scrapy and contain specific keyword. I've ...

0 answers

Detect language changes in file using Python

I need to detect language changes in a file, and tag each word accordingly. I've come up with a hacky way, that works for 2 languages (english and greek). The script is this: #!/usr/bin/env python # ...

0 answers

Cannot import gensim due to pattern.text module?

I have the required packages for gensim installed, but when I try to import and run gensim, it gives me this error: from pattern.text import (File ...

2 answers

Equivalent to vlookup for strings in Python?

Is there a way to search for a substring in a larger string, and then return a different substring x places left or right of the original substring? I want to look through a string like ...

2 answers | 4 mins ago by Ralph Braithwaite on Stack Overflow
0 answers

Modify xml using python

I have an xml file already generated by python and it looks like this. xml_screenshot I need to use python to change the sparkle:status from "live" to "expired" for the older version This ...

0 answers

Python programming, analyzing a data set

So basically what I want to do is analyze a data set that I have in a text file. I want to determine the frequency of appearance (expressed as a percentage) of the leading digits of each number in the ...

0 answers

Kernel dies when running a 3d plot in ipython console

So I'm trying to run a 3-d plot with a structured array that consists of a huge shape and size. from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np import os ...

0 answers

Calculate viewport that fitBounds() return for given bounds and map size

I have a web application with a server side and client side component. I perform the same geocoding request on both sides using the Google Maps HTTP API and Google Maps Javascript API. Both APIs ...

2 answers

regex to remove words from a list that are not A-Z a-z (exceptions)

I would like to remove non-alpha characters from a string and convert each word into a list component such that: "All, the above." -> ["all", "the", "above"] It would seem that the following ...

2 answers | 6 mins ago by Max on Stack Overflow
2 answers

TensorFlow MLP not training XOR

I've built an MLP with Google's TensorFlow library. The network is working but somehow it refuses to learn properly. It always converges to an output of nearly 1.0 no matter what the input actually ...

5 answers

Adding difference of pair of numbers in list using map/reduce

I am practicing exercises for functional programming concepts using python. I came across this problem. I have tried a lot and couldn't find a solution using functional programming constructs like ...

0 answers

findQuartiles func is going wrong somewhere

This func takes in a list of tuples like (wordLen, freq), and I have to find the quadrilles. Not, this list, for it is a summary, also the list in question is more conceptual. For example, an entry ...

0 answers

Contact Tracing in Python - working with timeseries

Let's say I have timeseries data (time on the x-axis, coordinates on the y-z plane. All points (nodes) have a flag that can be set to 0 or 1. At time 0 (not shown), there is at least one node set ...

0 answers

Python TypeError: an integer is required while working with Sockets on the client side

can some one help please, i am running my code connecting the client to the server that connects to a database and when i am sending the info from the client to the server with the ID as an int, an ...

1 answer

Python compare 2 files to get specific output

So I have 2 files. File A (there are no headres in this file) ag bb hg_tf gtf File B field id ag ytyv bb kgka hg_tf ghhg gtf brown 01 0 1 ...

1 answers | 11 mins ago by user5511186 on Stack Overflow
0 answers

urllib2 authentication with Bentley Web Services

I am building a tool that consumes Bentely Web Services REST API. I need to use urllib2 as my library because I don't know if I will be able to installl any non-core libraries when I deploy this code. ...

1 answer

split file by lines into many different files - name each file with index of original file

I have a large .txt file that I wrote to file using `df.to_csv(header=True,index=True,sep="\t") in python` I would like to split that file into files of len(index) = 2, using linux: split -d -a ...

1 answers | 11 mins ago by BML on Stack Overflow
0 answers

Flask - Apache Internal Server Error without log entry

I built a webapp using the flask framework, sqlalchemy and sqlite and recently deployed it on a VPS. It works perfectly for the cover page and the legal page, however I get a "500 Internal Server ...

2 answers

How can I extract values from a list of tuples inside a dictionary?

d={'Test':'Math','results':[{'name':'Paul','score':78},{'name':'Ann','score':87},{'name':'John','score':82}]} I have this dictionary with a list inside. I would like to sum the score: 78+87+82. I've ...

1 answer

Telnet from inside a telnet session (Python)

I am trying to telnet to a remote device from another remote device, doing a nested telnet using telnetlib. While I can easily communicate with the first device, I am not able to get the output from ...

1 answers | 14 mins ago by sg491 on Stack Overflow
1 answer

Selenium webdriver.Firefox(proxy=proxy) not effective

from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.proxy import * myProxy = ...

1 answers | 15 mins ago by RoryGillum on Stack Overflow
1 answer

How to pass non-const std::vector<double> by reference to Python with boost::python?

I would like to be able to give an empty std::vector<double>& as argument of a Python function able to fill it. Something like that : Python file : class Foo : def bar(self, x) : ...

1 answers | 15 mins ago by Caduchon on Stack Overflow
1 answer

Matplotlib Plot Lines Above Each Bar

I would like to plot a horizontal line above each bar in this chart. The y-axis location of each bar depends on the variable 'target.' I want to use axhline, if possible, or Line2D because I need to ...

0 answers

Python code to find coding DNA with start and stop codons

So recently I've been trying to write a program that detects and cuts out the coding part of a DNA sequence based on start and stop codons. The eventual goal is to compare 2 sequences of both 240 ...

0 answers

Check if geographical point exists at location (x,y) in worldmap

I was assigned a text adventure game in class and one section of the code goes like this class World: def __init__(self, mapdata, locdata, itemdata): self.geographicalloc = {} def ...

1 answer

Set a python variable to a C++ object pointer with boost-python

I want to set a Python variable from C++ so that the C++ program can create an object Game* game = new Game(); in order for the Python code to be able to reference this instance (and call functions, ...

3 answers

Pandas Grouper by frequency with completeness requirement

I have monthly time series data that is both missing some entries and has scattered NaN values for other reasons. I need to aggregate the data into Quarterly and Annual series, but I do not want to ...

1 answer

wxPython BusyInfo widget no longer works

In my wxPython GUIs, the wx.BusyInfo widget no longer works. I'm working on OSX, and I recently upgraded to El Capitan. This simple code below doesn't work anymore with either of the wx versions ...

1 answers | 20 mins ago by J Jones on Stack Overflow
15 30 50 per page
1 2 3