I have a two boxplotes But I want to place them in one graph to compare them. Have you any advice to solve this problem? Thanks! Answer Use return_type=’axes’ to get a1.boxplot to return a matplotlib Axes object. Then pass that axes to the second call to boxplot using ax=ax. This will cause both b…
Tag: python
Flask cannot import enumerate? UndefinedError: ‘enumerate’ is undefined
I just write this code in a HTML page. So, Flask do not support the enumerate? Answer As Or Duan says, Jinja2 has its own language. Looks like Python but it’s not Python. So the Python enumerate built-in function is not part of Jinja2 template engine. There are, however, some alternatives you can use: I…
Python :TypeError: this constructor takes no arguments
When the user enters an email address, and the program reads the email and display it according to its criteria (e.g yeo.myy@edu.co), like criteria: username is yeo.myy domain is edu.co I know its something to do with the “@”. this is the code this is the error I got: Answer Did you mean __init__?…
Printing a list to a Tkinter Text widget
I have a list of strings, and I want to print those strings in a Tkinter text widget, but I can’t insert each string in a new line. I tried this but didn’t work: Answer Append newline (‘n’) manually: BTW, you don’t need to use index to iterate a list. Just iterate the list. And d…
Qt Framework, PyQt5 and AttributeError: ‘MyApp’ object has no attribute ‘myAttribute’
Last week I started to learn Python and I developed some command line apps. Now I would like to develop apps with GUI. I searched in internet and I found a project that fits my needs: Qt Project (http://qt-project.org) and PyQt (http://www.riverbankcomputing.com/software/pyqt/intro). I installed Qt 5.3.2 Open…
String replace doesn’t appear to be working [duplicate]
This question already has answers here: Why doesn’t calling a string method (such as .replace or .strip) modify (mutate) the string? (3 answers) Closed 7 months ago. I initially tried using = operator to assign value but it returned an error, then I tried using string.replace(): and But it is returning …
Check if dataframe column is Categorical
I can’t seem to get a simple dtype check working with Pandas’ improved Categoricals in v0.15+. Basically I just want something like is_categorical(column) -> True/False. We can see that the dtype for the categorical column is ‘category’: And normally we can do a dtype check by just …
Django authenticate using logged in windows domain user
I want to authenticate django web user using windows domain account (active directory) who currently logged in to computer. How can I do this without prompting user to enter username/password again since he is already logged in using domain account to his system. I am using django and python 2.7. I went throu…
Writing then reading in-memory bytes (BytesIO) gives a blank result
I wanted to try out the python BytesIO class. As an experiment I tried writing to a zip file in memory, and then reading the bytes back out of that zip file. So instead of passing in a file-object to gzip, I pass in a BytesIO object. Here is the entire script: But it is returning an empty bytes object
plyr or dplyr in Python
This is more of a conceptual question, I do not have a specific problem. I am learning python for data analysis, but I am very familiar with R – one of the great things about R is plyr (and of course ggplot2) and even better dplyr. Pandas of course has split-apply as well however in R I can do things