Data_Extractor Python Outputting wrong year

I am trying to complete a fairly simple task - extract the dates from a corpora of emails (all time-stamped). I've tried a few different Python packages, none of which seem to work. Below is from date_extractor import extract_dates y = "Message-ID...
more »

2017-03-19 23:03 (2) Answers

Find out the instances of a particular class

I think this is a weird question, but maybe some of you would be able to answer it. I am looking for importing a library from python or using a plugin in Vim that will allow me to find out where are located the instances of a particular class or acc...
more »

2017-03-19 22:03 (0) Answers

Install python-igraph in Mac OSX Sierra

I have anaconda installed in my Mac. I am trying to install python-igraph. I tried the following commands to install it: $ brew install igraph $ pip install python-igraph My python setup: Python 2.7.13 |Anaconda custom (x86_64)| (default, Dec 20...
more »

2017-03-19 20:03 (1) Answers

Python in place object update in a for loop

In Python >= 3.5: x = np.zeros((2,3)) for x_e in x: x_e += 123 This operation returns a 2x3 matrix of all 123's. Whereas the following returns all zeros: x = np.zeros((2,3)) for x_e in x: x_e = 123 This is a little off putting to me sin...
more »

2017-03-19 19:03 (2) Answers

Converting row in timeseries data to column

Suppose that I have a timeseries like In [41]: df = pd.DataFrame(dict(names=list('abcaabcabbcc'), vals=np.random.randint(0, 10, 12)), index ...: =pd.date_range('2017-03-01', periods=12)) In [42]: df Out[42]: names vals 2017-03-01 ...
more »

2017-03-19 19:03 (2) Answers

No Reverse Match For Some URLs in Django 1.10

I am making an web app in Django 1.10 and am getting an annoying error which I cannot seem to resolve. In this project there are several Django app whose URLs function without problems and seem to have similar setup as the new Account app. However, t...
more »

2017-03-19 18:03 (1) Answers

pandas dropping columns based on column name

all Let's say there is a df with some column names - in my case the names are numeric values. For example, column named 1000, 1001, etc. I need to drop everything that doesn't pass a certain filter test - in my case, all columns with names less th...
more »

2017-03-19 16:03 (3) Answers

About Inheritance and super()

Given the code: class Character(): def __init__(self, name): self.name = name self.health = 50 self.damage = 10 class Warrior(Character): def __init__(self, name, weapon, armor): super(Character).__init__() ...
more »

2017-03-19 12:03 (1) Answers

Using Python for adding column in a CSV file

I have csv file (inputFile) like below: Temperature,2,3 Temperature,5,6 Pressure,11,14,45 Pressure,13,23,16 Humidity,21,24,25 Humidity,27,28,26 and I want to write it into another file(outputFile), but in the following format: Temperature,2,3,Pre...
more »

2017-03-19 11:03 (4) Answers

Printing and Formatting an Instance

I am trying to Define a str method for this class here so that when an instance of class Student is printed, it prints something of the format: My name is ___. I've been in college for __ years and I've written __ programs. Below the correct phrasing...
more »

2017-03-19 03:03 (4) Answers

Separating row values to a new column

I have this kind of pandas dataframe output, columns are at the top row: Date, Team1, Team2, Map, Event 17/3/17, Misfits 16, Cloud9 4, overpass, Pro League 17/3/17, TyLoo 16, Born Of Fire 4, cache, Pro League 17/3/17, Liquid 8, Renegades 16, cbble, ...
more »

2017-03-18 22:03 (3) Answers

Big 'O' - time complexity of function

Trying to find the time complexity of a function. The function is: def test(self, alt): same = Sample() for i in self.items: if alt.func1(i): same.func2(i) return same func1 has a complexity of O(s) where s is th...
more »

2017-03-18 21:03 (1) Answers

Converting Python REST API Calls to Power Query

I am working with a cloud-based service that is exposed using OAuth REST API. I have a working Python script, with which I am able to first post username, password and api token to get an authentication token. Then I use the api and authentication ...
more »

2017-03-18 21:03 (0) Answers

Doubly-linked list implementation not working

I'm new to object-orientated programming and to this site. I've been working on this program for a university-project for quite a while (or at least I'm trying to). I have to create a program that deals with doubly-linked lists, to be more precise, ...
more »

2017-03-18 21:03 (1) Answers

Cache a spatial lookup in Django

I work with Python 2.7 & Django 1.9. I managed to cache results of a spatial queryset when based on a polygon, but I can't manage to cache it when based on Distance from a location. The error returned is: "TypeError: can't pickle Binary objects...
more »

2017-03-18 20:03 (0) Answers