Tagged Questions
Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use. Please mention the version that you are using when asking a question about Python.
-4
votes
1answer
36 views
Can someone explain what is wrong with my codes?
I want to make a function that return the sum of all the multiple of 3 or 5 that below 1000
def trying(number):
box = 0
while number < 1000:
if number %3 or %5:
box = box + ...
0
votes
0answers
12 views
opening an excel file and writing to it in python
How do I open an existing excel file, write to it, and save it as the same filename. None of the previous data should be lost and the new data should be saved.
The pseudocode would be as follows:
...
2
votes
1answer
19 views
how to get the date from datetime
I have a datetime object and I'm trying to individually get a string with the date, and one with the time. I'd like the values for theDate and theTime to be strings.
theDate = myDatetime.date()
...
0
votes
0answers
5 views
Saving pdfs from mongodb bson
I've got a fairly large inherited mongodb instance and I'm trying to do some processing on a number of pdfs that we've got stored away in bson documents. Basically what I've got now is a ...
1
vote
0answers
5 views
Best way to generate day-of-week boxplots from a Pandas timeseries
i am trying to create a set of day-of-week boxplots for a timeseries (e.g. 5-minute temperature observations).
My code:
# ts is our timeseries
ts = df.SomeColumn
dow_map = {}
days = ...
0
votes
0answers
16 views
Ensuring all Django views return 200?
I have lots of simple Django views that look like this:
@team_leader_required
def view_all_teams(request):
teams = Team.objects.all()
template_vars = {'toolbar': 'teams',
...
0
votes
0answers
14 views
django template: include a *relative* file but don't parse it
How can one include a file in a django template like {% include %} would, but without parsing the file's contents ?
I am aware of {% ssi %} but that last one would not accept relative paths and ...
1
vote
0answers
27 views
Opening a file in Python given the dirrectory
If i have the following dirrectory to a file, how would I go about opening that file and then reading the contents from that file?. I know how to open the file if it is just the one file, when I open ...
0
votes
0answers
6 views
Is the any way show pip packages dependesies tree?
I have project with many packages, main packages I listed in requirements.txt. When I try pip freeze it print me current packages as plain list. So I prefer also get dependencies something like this:
...
1
vote
1answer
6 views
Apache log file data analysis with python pandas
The problem with me is bit hard to explain. I'm analyzing a Apache log file which following is one line from it.
112.135.128.20 - [13/May/2013:23:55:04 +0530] "GET /SVRClientWeb/ActionController ...
1
vote
0answers
14 views
nice decimal.Decimal autonormalization
This gonna be my first question here. I am trying to make a decimal.Decimal child class which mainly differs the parent by making autonormalization on itself and on the results of its callable ...
0
votes
1answer
10 views
django regroup templatetag does not group properly
I have following template
{% regroup product.hotel.facilities.all by facilitytype as facilities %}
{% for facility in facilities %}
<h5>{{ facility.grouper }}</h5>
<p ...
0
votes
1answer
12 views
how to get a value out of ValuesQuerySet
I'm trying to extract some data from my database in my Django app with the following line of code. Job is the name of my model and jobIDs[i] represents the id of the record being operated on.
...
1
vote
1answer
14 views
Plot numerical string values in matplotlib
Suppose I have:
x = ['1.34511','0.0234','-0.0890']
y = ['0.0987', '0.8763', '-0.0762']
How can I plot those values in matplotlib?
I've already made a search about 'ticks', but I still don't ...
0
votes
0answers
5 views
How to format special characters inserted into a Jinja2 template?
I want to insert a bullet into an HTML file generated by a Jinja2 template. The Python code sends the string
'●'
but when in the HTML code it's generated as
&#9679;
so the ...