Skip to content

Tag: python

_tkinter TclError: can’t find package Tix

A friend sent me some Tkinter/Tix code, but it was for Python 2: I have Python 3, I have no Tix installed, and program crashes. After some searching I’ve changed the code to: Thats what I found on the internet. I have no idea if this is a right approach. But code still does no run it crashes on I

auto.arima() equivalent for python

I am trying to predict weekly sales using ARMA ARIMA models. I could not find a function for tuning the order(p,d,q) in statsmodels. Currently R has a function forecast::auto.arima() which will tune the (p,d,q) parameters. How do I go about choosing the right order for my model? Are there any libraries availa…

Python passing callback function in a class

I have to try to move from the non-class-based coding style into class-based coding style, but facing an issue. The optimize() function takes a callback function mycallback(). The code works perfectly fine in Non-class-based method, but when I moved it to class-based method, I got an error “mycallback()…

piping from stdin to a python code in a bash script

I have a bash script, f, that contains python code. That python code reads from standard input. I want to be able to call my bash script as follows: In the example above, the python code will read from input.txt and will write to output.txt. I’m not sure how to do this. I know that if I wanted to just

Best way of using google translation by Python [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 1 year ago. The community reviewed whether to reopen this question 1 year ago and left it closed: Origin…

Python Enum, when and where to use?

Python 3.4.0 introduced enum, I’ve read the doc but still don’t know the usage of it. From my perspective, enum.Enum is an extended namedtuple type, which may not be true. So these are what I want to know about Enum: When and where to use Enum? Why do we need Enum? What are the advantages? What ex…

Python lmfit – how to calculate R squared?

This may be a stupid question, but I didn’t find an answer to it anywhere in lmfit’s documentation. My question is simple: how do I retrieve R squared? (I know I can calculate it manually with 1 – SS_res / SS_tot) Update: I tried calculating R squared myself and compared it to the R squared …

AttributeError ‘tuple’ object has no attribute ‘get’

I have a Django application. But i can’t an error that i have been struggling with for some time now. And this is the traceback django provides me. I have a hard time figuring out why this error occurs. How can i find out where that tuple is in my code? The view: Answer You are returning a tuple here: