James Stamp

James Stamp

Location Liverpool UK



  • Very important advice

  • Thanks @ClintD .

  • I think the Ebook Work Turtles link above is not completely correct as it is trying to open the course py4e-int instead of fl-py4e

    The correct link is

  • I hope to gain more understanding of the services available in AWS. The options available can be quite overwhelming without some guidance

  • James Stamp made a comment

    The importance of getting the presentation of the data analysis correct in order to get the message across to the target audience. Seaborn will be really helpful in achieving this.

    I would like to learn a lot more about the abilities of Matplotlib and Seaborn

  • import pandas as pd
    import seaborn as sns
    import matplotlib.pyplot as plt

    filename = 'penguins.csv'
    data_frame = pd.read_csv(filename)
    sns.set(rc={'figure.figsize': (6, 6)})

    ax = sns.scatterplot(

  • import pandas as pd
    import seaborn as sns
    import matplotlib.pyplot as plt

    filename = 'climate.csv'
    df = pd.read_csv(filename)
    sns.scatterplot(data=df, x='City', y='Temperature')

    Correlation between City and Temperature is low

  • A very interesting article. Data storytelling has often felt like an after-thought in other data analysis courses I have took part in.

  • James Stamp made a comment

    Still getting to grips with what is possible with Pandas. I'd like to learn a lot more about the library as it appears to be a very useful and powerful analysis tool.

  • import pandas as pd
    import numpy as np
    from pandas import Series, DataFrame

    filename = '.\dataset/Brazilian-states-and-capitals.csv'
    df_flow = pd.read_csv(filename)
    ds1 = df_flow.stack()
    ds2 = ds1.unstack()

    1 States Acre
    Capitals Rio Branco
    2 States ...

  • import pandas as pd
    import numpy as np
    from pandas import Series, DataFrame
    df1 = pd.read_csv(".\dataset/climate.csv")
    df2 = pd.read_csv(".\dataset/Week+2.csv")
    df3 = pd.read_csv(".\dataset/Week+3.csv")
    result = pd.concat([df1, df2, df3])

    City Temperature Weather Year State Month Number of Fires Date Reported
    0 Rome ...

  • import pandas as pd
    import numpy as np
    from pandas import Series, DataFrame

    filename = ".\dataset/Brazilian-fire-dataset.csv"
    df_fire = pd.read_csv(filename)

    Year State Month Number of Fires Date Reported
    0 1998 Acre January 0.0 1/01/1998
    1 1999 Acre January ...

  • James Stamp made a comment

    The Pandas library is really powerful. A lot of data manipulation can be achieved with only a few lines of code.

    I'd like to learn more about other functions available in the Pandas library.

  • States Capitals
    0 Acre Rio Branco
    1 Alagoas Maceió
    2 Amapá Macapá
    3 Amazonas Manaus
    4 Bahia Salvador
    5 Ceará Fortaleza
    6 Distrito Federal Brasília
    7 Espírito Santo Vitória
    8 Goiás Goiânia
    9 Maranhão São...

  • import pandas as pd
    import numpy as np
    from pandas import Series, DataFrame

    data = {
    'States': ['Acre', 'Alagoas', 'Amapá', 'Amazonas', 'Bahia', 'Ceará', 'Distrito Federal', 'Espírito Santo', 'Goiás', 'Maranhão'],
    'Capitals': ['Rio Branco', 'Maceió', 'Macapá', 'Manaus', 'Salvador', 'Fortaleza', 'Brasília', 'Vitória', 'Goiânia', 'São Luís'],

  • import pandas as pd
    import numpy as np
    from pandas import Series, DataFrame

    data = {
    'states': ['Acre', 'Alagoas', 'Amapá', 'Amazonas', 'Bahia', 'Ceará', 'Distrito Federal', 'Espírito Santo', 'Goiás', 'Maranhão', 'Mato Grosso',
    'Mato Grosso do Sul', 'Minas Gerais', 'Pará', 'Paraíba', 'Paraná', 'Pernambuco', 'Piauí', 'Rio de Janeiro',...

  • CODE:
    import pandas as pd
    import numpy as np
    from pandas import Series, DataFrame

    myDictionary = {'R': 'Red', 'P': 'Purple', 'G': 'Green', 'Y': 'Yellow', 'W': 'White', 'B': 'Black'}
    mySeries = Series(myDictionary)
    mySeries.name = 'House'


    R Red
    P Purple
    G ...

  • CODE
    sales = 150, 180, 200, 90, 135, 98, 'Yet to receive'
    (150, 180, 200, 90, 135, 98, 'Yet to receive')

    sales_list = list(sales)

    [150, 180, 200, 90, 135, 98, 'Yet to receive', 100]

  • Code:
    firstName = 'Lauren'
    middleName = 'Hurrier'
    lastName = 'Manual'
    print(firstName + ' ' + middleName + ' ' + lastName)

    Lauren Hurrier Manual

  • fruit = ('apple', 'banana', 'grape')
    ('apple', 'banana', 'grape')

    False = "True"
    async = 1
    import = 10.5
    File "<ipython-input-7-f3ed83b179f6>", line 2
    async = 1
    SyntaxError: invalid syntax

    _False = "True"
    _async = 1
    _import = 10.5
    print(_False, _async, _import)
    True 1 10.5

  • My first choice would be Python for data mining and manipulation as it is quick to pick up and there are a number of good libraries that can be accessed. Would also SQL if any interactions with DBs are required.

  • I have some computing projects that use twitter data and data from some APIs. Hoping to get a better understanding of Pandas to improve the analysis and presentation of the findings

  • Hi @MacBowley(he/him), sorry about that. There was an extra character at the end of the link. Correct link is < https://pastebin.com/XYPK6SAx >

  • Eventually got it working.

    Code here for server and client files here <https://pastebin.com/XYPK6SAx>

  • Great, it worked. It is amazing how much can be achieved with only a few lines of code

  • Hi @RobBoult. Did you find a solution to this? I'm experiencing the exact same issue.

  • A very fascinating video. Really good to see.

  • A very interesting week. The presentation of the material is excellent.

  • Really good video. It's amazing how much you can do with only a few lines of code.

  • I found the computerphile video is very informative. Well worth watching

  • This is really great content. Easy to understand and follow.

  • A great introduction. Very clear and succinct

  • Hi @ChineloNwaiwu, thanks for taking the time to check out my code and providing feedback. Amended code here https://pastebin.com/5NYmggk8

    I wasn’t aware of the quit() function. I’ll check that out.

  • Hi @Andreray, thanks for information about f / format. I’ll certainly check this out.

  • Excellent course and very enjoyable. The exercises really help in understanding the concepts presented. It is amazing how much can be created with just the concepts covered on 4 weeks.

    Many thanks to all involved in creating and delivering this course.

  • RPG Info game here. There are four classes - room, item, character, rpginfo
    There is also a main program (main)


    game allows the player to fight, talk, explore rooms, use items, take items dropped by enemies, check character inventory. Coding for all four challenges is included

  • James Stamp made a comment

    Update the Room class. It now has a mixture of attributes and properties
    class Room():
    numberOfRooms = 0

    def __init__(self,roomName):
        #object attributes
        self._name = roomName
        self._description = None
        self._items = None
        self.exits = None
        self.linkedRooms = {}
        self._character =...
  • Hi @FilimonDiamantidis, I found this website helpful in understanding the difference.

    In short,

    • A class method can change class variables, but cannot change instance variables
    • A static method cannot change class or instance variables


  • Interesting week. Coding the objects seems straightforward, but I can see it can become quite complex to maintain / debug if the objects are not designed properly.

    Are there any best practice guides as for the design of objects, specifically for methods that check / use attributes of a class? (Sometimes, I am not sure if I need a method in an object class…

  • Mini game here.
    Two characters - populate the map, a Friend and an Enemy
    Possible Actions - display, help, fight, talk, north, south, east, west, exit

    display - display information about current room
    help - shows possible actions
    fight - fight Enemy character if they are in the room. The Friend character will not fight
    talk - character will…

  • Code for enemy class and the fight with Zach the Zombie


  • ~~~
    from character import Character
    polly = Character(‘Polly’,’Poll just repeats what you say’)
    chat = True
    while chat:
    comment = input(‘Enter something to say to Polly:’).strip()
    if comment == ‘’:
    chat = False

  • ~~~
    class Item():
    def init(self,roomName):
    #object attributes
    self.name = name
    self.description = None
    self.value = None

    def set_name(self,name):
        self.name = name
    def get_name(self):
        return self.name
  • ~~~
    class Room():
    def init(self,roomName):
    #object attributes
    self.name = roomName
    self.description = None
    self.items = None
    self.exits = None

    def set_description(self,description):
        self.description = description
    def get_description(self):
  • Methods
    north, south, east, west, up, down

    size, colour, descriptions, items, exits, description

  • Code draws 20 shapes of random size, colour and position.

    from shapes import Paper, Triangle, Rectangle, Oval
    from random import randint

    def getColour():
    #return a random colour string
    colours = [“red”,”orange”,”yellow”,”green”,”blue”,”indigo”,”purple”]
    colour = colours[randint(0,6)]
    return colour

    def drawRectangle():

  • James Stamp made a comment

    My Turtle race here: https://pastebin.com/99SRygZB

    Continues until a turtle reaches a finishes line (x-coord =200). Turtles have been given different upper and lower speeds

  • I really enjoyable course. The exercises really helped in understanding the concepts presented. Thanks to all involved in producing and presenting the course.

  • Binary Search is a lot quicker than the Linear Search.

    Binary search - results are always coming back as 0 seconds for lists as long as 9999999.

    Linear search - in general, the longer the list, the time taken to return a result increase


  • Various implementations of the Binary Search
    - Standard Search
    - Leftmost element if multiple matches occur
    - Rightmost element if multiple matches occur
    - Closest element if a match doesn't occur


  • James Stamp made a comment

    Digital Marketing is more targetable and dynamic in it's delivery methods (eg to change the recipients for a mailshot in traditional marketing would require readdressing multiple envelopes, whereas the same mailshot with emails may only take a couple of minutes to change the recipient group)

    The delivery methods are completely different. Traditional...

  • A really enjoyable. The mix and of presentations and exercises was the right level. In addition, I found the concepts / ideas were presented clearly.

    The one thing I struggled with was debugging with the Mu environment. Sometimes, it took me a bit of time to find out what a particular errors were due to not knowing my way around the IDE.

    Thanks to...

  • One additional value that could be recorded after each round is the value chosen leading to the a win or defeat.

  • Code with a statistics of win rates for each card


    This version is completely automated and will produced up to 25000 card comparisons. Uncommenting the line #stat = chooseStat() within the mainLoop function will allow a person to play.

    There is also a line clearTable(conn,'result') in the main program body that, if...

  • Game code here
    - requests number of rounds and names of players
    - one player game against the computer


  • James Stamp made a comment

    Code to pick random card and, if different from previous card, will add to picked table.

    Code clears the picked table from entries at start of program. Program continually asks to pick another card until the user enters something other than D or Y. Entering D will display the current records from the picked table


  • James Stamp made a comment

    A little application with all CRUD operations


  • James Stamp made a comment

    A really great week. There was a lot of new things introduced, enough to go away and practice with.

  • Updated RPG code to check health is between 0 and 5. Anything lower than 0 or higher than 5 is highlighted as cheating


  • Hi @SteveSeabrook, to suppress the display of <class 'str'> <class 'float'>, remove or comment out the final print line.


  • RPG code with load and save functionality. Updated the showStatus code to display the possible directions from the current position


  • Code to read from and write to CSV file. Had an issue with the write method creating an additional blank line after each row entry. Found a post on StackOverflow forum with one potential solution to this


  • Hi @SteveSeabrook, the <class 'str'> <class 'float'> output is due to the line print(type(row[0]), type(row[1])) in your second with block.

  • Math Quiz with plot added.

    I need to play around with the bar chart settings and properties though as the bars are being displayed in a strange way (the higher scores are being displayed with smaller bars)


  • Maths quiz with randomly generated questions. Took a bit of testing and googling to get the right python commands I wanted, but got there in the end.