Questions tagged [dict]
The dict tag has no usage guidance.
8
questions
0
votes
1answer
22 views
Problem taking a SUM with SQL to python
I am doing Finance and I am fighting with this code... could anyone help me?
I want to "select" some data from a sql table and put this value to a variable in python (a specific FLOAT number)...
0
votes
1answer
65 views
Help please: I keep getting - TypeError: unhashable type: 'dict'
I keep getting - TypeError: unhashable type: 'dict'
at line:
return HttpResponseRedirect (reverse("encyclopedia:index", {
"entries": util.save_entry(title, content)
}))
My code is ...
1
vote
1answer
22 views
Iterate over a list of dicts and get key value pair of specific keys
I'm trying to iterate over a list of dicts and get only the symbol and company name out of it maybe store in another dict, I tried parsing the json file directly and failed. I tried searching all the ...
0
votes
1answer
69 views
pset7 “index” - using SQL SUM adds a parenthesis to returned dict strings
I executed the following to return a dict (grouped by stock symbols) of stock symbols, total shares and total value owned.
stocks = db.execute("SELECT buy.stock_code, SUM(buy.value), SUM(buy.shares) ...
1
vote
0answers
101 views
Pset7 - Quote always returning apology
So, I'm struggling with pset7 a lot (mostly because I've never programmed before either =/) now I'm on quote and it's always rendering an apology after I fill in the form. I can't quite figure out ...
0
votes
1answer
28 views
Question about python dict syntax, how to past from one dict variable to another?
why does this code not work and gives back (TypeError: 'str' object does not support item assignment) :
sharesOwned = {'name': 'Apple.inc', 'symbol': 'AAPL', 'price':110, 'name': 'Google', 'symbol': '...
0
votes
1answer
792 views
For loop help in python
i'm trying to do a 'for' loop in python, but my values keeps getting replaced. How can i write the code below in a way where i can keep a record of each iteration?
Should i be using a list[] instead ...
0
votes
1answer
70 views
want to create a new dict in pset7
In index, how do I create a new dict which takes all the non-zero share entries to display. For example I can use stocks = db.execute and use SUM(shares) to get the total shares for each stock. But ...