Data dodania Pytanie
2017-05-04 17:05 Python built-in max(), when 2 values are the same which one gets picked? »
I have a code that processes data based on some dates. Lets say: case1: values1 with date1 = '2002-02-01' values2 with date2 = '2004-02-01' case2:...
(2) odpowiedzi
2017-05-04 05:05 Split text to csv by other delimiter but maintaining the comma in each column »
I have a txt file containing pipe | delimited values, but unfortunately, I have encountered some errors , the csv DictReader assumed that the comma in...
(1) odpowiedzi
2017-05-03 10:05 Rebase csv file by merging a base csv file with another new csv file »
I am currently working with two csv files, base.csv and another csv file, output_20170503.csv which will be produced everyday, so my aim here is to re...
(2) odpowiedzi
2017-05-03 09:05 Unknown spaces in output of python script after postgresql database query »
I am trying to execute a query from postgresql database using the psycopg2, but my problem here is the output I get contains unknown spaces, Here is ...
(1) odpowiedzi
2017-05-03 05:05 Install Numeric (old numpy) and old version of Python (e.g. Py 2.4) »
I have some very old Python code (written around the time of Python 2.2/2.3 and using Numeric libraries which I understand were the precursor to Numpy...
(0) odpowiedzi
2017-05-02 12:05 Syntax error only in python 3 »
I have the following code which runs fine on python 2 but throws error on python 3 import sys if sys.version_info > (3,): #print("Python 3") #...
(2) odpowiedzi
2017-04-29 21:04 How to change an element in a list and keep it that way forever in the code? »
I already know how to change an element of a list into another one: data = ["foo","bar","baz"] for i in xrange(len(data)): if data[i] == "foo": ...
(3) odpowiedzi
2017-04-28 16:04 Regular expressions with non-english unicode phrases using re.compile »
I want to return true or false, by asking whether a string includes unicode characters (in short sequences like phrases). words = ['你好朋友','
(2) odpowiedzi
2017-04-28 07:04 Tkinter not displaying to root when inside a class definition »
Trying to understand why Tkinter will display this image in the main method, but not when the root = Tk() variable is passed into a class. The display...
(1) odpowiedzi
2017-04-28 02:04 Python 2 import builtin »
I need to make code compatible for Python2/3 and it uses the dict() builtin, but I can't figure out how to import it from the __future__ module. For ...
(0) odpowiedzi
2017-04-26 17:04 Filtering words starting with '\' from Python »
I am acquiring tweets from twitter and I want to do term frequency but avoiding emoticons and strange characters. I have seen that this characters hav...
(1) odpowiedzi
2017-04-26 06:04 Missing headers in csv output file (python) »
I am trying to output a csv file, but the problem is, the headers are gone, and I tried looking at my code line by line but I don't know what's wrong ...
(2) odpowiedzi
2017-04-24 23:04 How to pass dynamic length variables with values in one line to a function »
I've already looked into this SO answer here for passing dict key,value pair to a function, but it does not solve my problem completely. I've an ex...
(1) odpowiedzi
2017-04-23 14:04 Error after "from new import instancemethod" when importing scipy.stats »
I am getting an exception from scipy whenever I try to import the nltk package. The command and the error looks like this: >>> import nltk T...
(1) odpowiedzi
2017-04-23 04:04 SQLAlchemy Unicode Problems in Exceptions »
I'm working on a Flask app with a postgres/SQLAlchemy/Flask-Admin. However, in the Admin interface, any DB error that contain Unicode letters can't be...
(0) odpowiedzi
2017-04-21 16:04 A confusion on type.__init__ in Python 2 »
Take a look at the following example class Base(type): def __init__(cls, name, bases, dict_): print 'Base.__init__() with cls %s, name %s...
(1) odpowiedzi
2017-04-19 23:04 How to get source code of function that is wrapped by a decorator? »
I wanted to print the source code for my_func, that is wrapped by my_decorator, import inspect from functools import wraps def my_decorator(some_fun...
(2) odpowiedzi
2017-04-19 18:04 Python € in filename »
I need to be able to read or rename a file that contains the character: €. This character has a random position that I get with a. How can I do it? ...
(2) odpowiedzi
2017-04-19 08:04 What is python .. ("dot dot") notation syntax? »
I recently came across a syntax I never seen before when I learned python nor in most tutorials, the .. notation, it looks something like this: f = 1...
(4) odpowiedzi
2017-04-18 22:04 Using PrettyTable, Can I write a function that will take inputs and add them into a table so I don't have to continuously repeat myself? »
I made a multiplication table, but I had to manually type out the code to add to my table. I want to write a loop that does it for me so the multiplic...
(1) odpowiedzi
2017-04-18 00:04 Python2 datetime - Convert epoch time to UTC timestamp with offset »
I am using Python 2 due to reasons beyond my control and hence cannot upgrade to Python 3 (which has better support for timezones). I have an epoch t...
(2) odpowiedzi
2017-04-16 21:04 Python Recrusive Statement Error not Defined »
I am trying to test each input then return that the number is cleared then do the math. For Example is a user inputs N instead of a number I want it t...
(2) odpowiedzi
2017-04-16 18:04 Recursive Statement Errror »
Alright So I seem to be having an issue somewhere in my main function . I am able to input both Base and Exponent yet, When It moves onto the next fun...
(1) odpowiedzi
2017-04-13 20:04 Using python-onvif, is there some way that I can get the text of error responses? »
I'm experimenting with the python-onvif library and command line client to work with a network camera I have. When things are working it's fine, but...
(0) odpowiedzi
2017-04-13 17:04 Whitespace in the path of Windows filepath getting WindowsError: [Error 2] »
I am getting the error shown below. It looks like a path issue because of space. >>> from _winreg import * >>> aReg = ConnectRegist...
(0) odpowiedzi
2017-04-13 00:04 Python script can't be terminated through Ctrl+C or Ctrl+Break »
I have this simple python script called myMain.py to execute another python program automatically with incremental number: #!/usr/bin/python import ...
(0) odpowiedzi
2017-04-12 14:04 Why does my regex works on pythex and not in python? »
I've tested the following regex: r"([\d\s]{1,})\b(\s?[€]\s?)([\d]{1,})" on http://pythex.org and it actually works. The pattern is made to recogn...
(0) odpowiedzi
2017-04-12 05:04 How to iterate over all keys of a json with nested dictionaries and lists? »
I need to modify the following json file, test.json: { "install": { "site": { "acls": { "dns": { "authorized_ports": ["...
(2) odpowiedzi
2017-04-11 11:04 Python urlencode special character »
I have this variable here reload(sys) sys.setdefaultencoding('utf8') foo = u'"Esp\xc3\xadrito"' which translates to "Espírito". But when I pass m...
(2) odpowiedzi
2017-04-10 15:04 pycrfsuite : how to recall the saved models for more training »
I am using pycrfsuite now. I Know crf training model's saving. crf_trainer = pycrfsuite.Trainer() crf_trainer.train('crf.crfsuite') So, When I want...
(0) odpowiedzi
2017-04-09 09:04 Some characters stick to my colorized prompt in Python cmd »
I am using Python 2's cmd module to make a command line for a program. Everything works nicely as long as I don't add color to my prompt. Working co...
(1) odpowiedzi
2017-04-09 04:04 Using lambda functions to sum digits and count digits »
How can I convert these two functions to use lambda notation? def sum_digits(number): if number == 0: return 0 else: return (...
(3) odpowiedzi
2017-04-08 15:04 Lambda Return Payload botocore.response.StreamingBody object prints but then empty in variable »
I'm invoking a lambda function from another function and want to take a different action depending on the response, pretty standard stuff. However I g...
(1) odpowiedzi
2017-04-07 17:04 how to iterate on xml nodes (both elements and text nodes) in python2 etree »
I have a xml, in where an element contains multiple text nodes. Using python2 etree, I want to navigate the tree with the same order. So, for this in...
(1) odpowiedzi
2017-04-07 02:04 Unable to encode or decode the string properly »
I tried to look at bunch of stackoverflow examples. Python version used: Python 2.7.10 Output of the string s looked like u'bh\xfcghi' where \xfc=
(2) odpowiedzi