Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Sort y axis by descening values matplotlib
Post: Sort y axis by descening values matplotlib

See below code, the problem with this logic is that I want the y axis to be in a descending format where a league position of 1 is higher that 5. How can I set it up that the y axis is descending? im...
mrsenorchuck General Coding Help 0 3,797 Dec-08-2019, 08:13 PM
    Thread: Is it possible to check for a key error in a python dictionary?
Post: Is it possible to check for a key error in a pytho...

Hello, Hope you are well. Using a dictionary "Undergrads" with is list of students, it has a key made of two values to make each student unique their name and overall rank in the class. I want to f...
mrsenorchuck General Coding Help 0 1,460 Dec-06-2019, 11:38 PM
    Thread: Checking if the combination of two keys is in a dictionary?
Post: RE: Checking if the combination of two keys is in ...

(Dec-04-2019, 02:26 AM)Clunk_Head Wrote: (Dec-03-2019, 11:12 PM)mrsenorchuck Wrote: So currently my premier dictionalry has two keys and it has to have two to make the key value unique. These key...
mrsenorchuck General Coding Help 6 3,883 Dec-04-2019, 10:35 AM
    Thread: Checking if the combination of two keys is in a dictionary?
Post: RE: Checking if the combination of two keys is in ...

(Dec-03-2019, 10:58 PM)stullis Wrote: Here's an example of what you could do: from collections import namedtuple test = namedtuple("test", ["x","y","z"]) x = [test(4,5,6), test(5,6,7)] for each i...
mrsenorchuck General Coding Help 6 3,883 Dec-03-2019, 11:12 PM
    Thread: Checking if the combination of two keys is in a dictionary?
Post: RE: Checking if the combination of two keys is in ...

(Dec-03-2019, 10:28 PM)stullis Wrote: The current implementation does not work because keys in a dict cannot be looked up like that. You could use the namedTuple in the Collections module or try a N...
mrsenorchuck General Coding Help 6 3,883 Dec-03-2019, 10:32 PM
    Thread: Checking if the combination of two keys is in a dictionary?
Post: Checking if the combination of two keys is in a di...

Hello, Hope you are well. See below in bold, I want check if a key combination of club and year is present in a dictionary and then if it is append the value in [0] to a list but I am having trouble...
mrsenorchuck General Coding Help 6 3,883 Dec-03-2019, 09:53 PM
    Thread: invalid literal for int() with base 10: ''
Post: RE: invalid literal for int() with base 10: ''

(Dec-03-2019, 04:53 PM)ichabod801 Wrote: (Dec-03-2019, 04:39 PM)mrsenorchuck Wrote: The column DF has negative values, could that be the issue? No. The error indicates you are getting an empty str...
mrsenorchuck General Coding Help 5 5,432 Dec-03-2019, 09:35 PM
    Thread: invalid literal for int() with base 10: ''
Post: RE: invalid literal for int() with base 10: ''

(Dec-03-2019, 04:11 PM)ichabod801 Wrote: The way you are reading the data into individual variables makes it harder to debug. It would be easier if you had that info in a list or dictionary. Especia...
mrsenorchuck General Coding Help 5 5,432 Dec-03-2019, 04:39 PM
    Thread: invalid literal for int() with base 10: ''
Post: invalid literal for int() with base 10: ''

Getting an error "invalid literal for int() with base 10: ''" on the line where I assign the keys. What is the best way to debug? # dictionary keys will be the (Club and year) premier = {} print() #...
mrsenorchuck General Coding Help 5 5,432 Dec-03-2019, 03:48 PM
    Thread: Phyton code to load a comma separated csv file in to a dict and then in to a dB
Post: RE: Phyton code to load a comma separated csv file...

(Nov-28-2019, 09:43 PM)Larz60+ Wrote: what have you tried? Thank you for your reply. Reading in the csv to a dictionary is easy enough, see below what I have, the hard part for me is then getting d...
mrsenorchuck General Coding Help 2 2,661 Nov-29-2019, 10:59 AM
    Thread: Phyton code to load a comma separated csv file in to a dict and then in to a dB
Post: Phyton code to load a comma separated csv file in ...

Hello, Hope you are well. Looking to do the followoing steps: 1. load a comma separated csv file in to a named python dictionary converting numbers that appear as strings in to integers 2. Once th...
mrsenorchuck General Coding Help 2 2,661 Nov-28-2019, 08:58 PM
    Thread: Data Dictionaries in Python
Post: RE: Data Dictionaries in Python

See in your example below, are you defining a function "def_filter" that uses the data dictionary and then passing the team in position 4 to it to return the values for the team in position four? (No...
mrsenorchuck General Coding Help 16 7,334 Nov-25-2019, 09:29 PM
    Thread: Data Dictionaries in Python
Post: RE: Data Dictionaries in Python

(Nov-25-2019, 04:07 PM)DeaD_EyE Wrote: Quote:What is kwargs in your snippet? kwargs is just a name used by convention for keyword-arguments. The ** in front the name is important. Then all keyword-...
mrsenorchuck General Coding Help 16 7,334 Nov-25-2019, 04:14 PM
    Thread: Data Dictionaries in Python
Post: RE: Data Dictionaries in Python

(Nov-25-2019, 10:51 AM)perfringo Wrote: You should modify filter provided by Dead_EyE according to your needs. Thank you for your reply. So Dead_EyE's code can be used to filter down the records in...
mrsenorchuck General Coding Help 16 7,334 Nov-25-2019, 02:58 PM
    Thread: Data Dictionaries in Python
Post: RE: Data Dictionaries in Python

(Nov-25-2019, 08:26 AM)DeaD_EyE Wrote: You can make a filter-function. Instead of jumping directly into pandas, you should know also the Python stuff. def filter_by(data, **kwargs): for row in...
mrsenorchuck General Coding Help 16 7,334 Nov-25-2019, 09:36 AM
    Thread: Data Dictionaries in Python
Post: RE: Data Dictionaries in Python

So I used this appraoch below: How can I get the average points and pick teams that have finished first? Sample data at the very bottom # Purpose: Inputing data from a csv file # Example of: File i...
mrsenorchuck General Coding Help 16 7,334 Nov-24-2019, 08:02 PM
    Thread: Data Dictionaries in Python
Post: RE: Data Dictionaries in Python

(Nov-24-2019, 02:49 PM)perfringo Wrote: Working example: from csv import DictReader with open('premier_league.txt', 'r') as f: data = list(DictReader(f))data is list of dictionaries. We can 'q...
mrsenorchuck General Coding Help 16 7,334 Nov-24-2019, 05:04 PM
    Thread: Data Dictionaries in Python
Post: RE: Data Dictionaries in Python

(Nov-24-2019, 02:07 PM)snippsat Wrote: (Nov-24-2019, 10:50 AM)mrsenorchuck Wrote: Is the data already in columns with this code and if so how do I access individual items lke the 5th best team etc...
mrsenorchuck General Coding Help 16 7,334 Nov-24-2019, 02:11 PM
    Thread: Data Dictionaries in Python
Post: RE: Data Dictionaries in Python

(Nov-24-2019, 10:32 AM)DeaD_EyE Wrote: The csv module can do this for you. import csv result = [] with open('PL.csv') as fd: reader = csv.DictReader(fd) for row in reader: result....
mrsenorchuck General Coding Help 16 7,334 Nov-24-2019, 10:50 AM
    Thread: Data Dictionaries in Python
Post: RE: Data Dictionaries in Python

(Nov-24-2019, 03:35 AM)Larz60+ Wrote: Please post a small data sample (just a few rows) Thank you for your reply. Pos,Club,Seasons,Pld,Win,Draw,Loss,GF,GA,GD,Pts 1,Manchester United,27,1038,648,224...
mrsenorchuck General Coding Help 16 7,334 Nov-24-2019, 10:12 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020