why should I make a copy of a data frame in pandas

This expands on Paul’s answer. In Pandas, indexing a DataFrame returns a reference to the initial DataFrame. Thus, changing the subset will change the initial DataFrame. Thus, you’d want to use the copy if you want to make sure the initial DataFrame shouldn’t change. Consider the following code: You’ll get: In contrast, the following leaves … Read more

heroku: no default language could be detected for this app

I can’t remember how I fixed this but looking at the Date Modified in my files after I posted this question I created two files: runtime.txt (thanks rurp) which contains: Procfile which contains: This is a Django project and projectname.wsgi leads to a wsgi.py located at projectname/wsgi.py This contains:

TypeError: generatecode() takes 0 positional arguments but 1 was given

When you call a method on a class (such as generatecode() in this case), Python automatically passes self as the first argument to the function. So when you call self.my_func(), it’s more like calling MyClass.my_func(self). So when Python tells you “generatecode() takes 0 positional arguments but 1 was given”, it’s telling you that your method is set up to take no … Read more

How to upgrade pip3?

I want to use python3.5 to develop basically, but many times when I install the module for the python 3.5, it always failed. And the terminal told me that higher version is available, it did not work when I upgrade it.