James Stamp

Location Liverpool UK
Achievements
Activity
-
James Stamp made a comment
Very important advice
-
James Stamp replied to James Stamp
Thanks @ClintD .
-
James Stamp made a comment
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
https://runestone.academy/runestone/books/published/fl-py4e/turtles/names4turtles.html -
James Stamp made a comment
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
-
James Stamp made a comment
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as pltfilename = 'penguins.csv'
data_frame = pd.read_csv(filename)
sns.set(rc={'figure.figsize': (6, 6)})
sns.set_style('whitegrid')
sns.set_context('paper')
ax = sns.scatterplot(
data=data_frame,
x='bill_length_mm',
y='flipper_length_mm',
hue='species',
... -
James Stamp made a comment
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as pltfilename = 'climate.csv'
df = pd.read_csv(filename)
sns.scatterplot(data=df, x='City', y='Temperature')Correlation between City and Temperature is low
-
James Stamp made a comment
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.
-
James Stamp made a comment
import pandas as pd
import numpy as np
from pandas import Series, DataFramefilename = '.\dataset/Brazilian-states-and-capitals.csv'
df_flow = pd.read_csv(filename)
ds1 = df_flow.stack()
print(ds1.head())
print(ds1.tail())
ds2 = ds1.unstack()
print(ds2.head())
print(ds2.tail())1 States Acre
Capitals Rio Branco
2 States ... -
James Stamp made a comment
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])
print(result)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, DataFramefilename = ".\dataset/Brazilian-fire-dataset.csv"
df_fire = pd.read_csv(filename)
print(df_fire)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... -
James Stamp made a comment
import pandas as pd
import numpy as np
from pandas import Series, DataFramedata = {
'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'],
... -
James Stamp made a comment
import pandas as pd
import numpy as np
from pandas import Series, DataFramedata = {
'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',... -
James Stamp made a comment
CODE:
import pandas as pd
import numpy as np
from pandas import Series, DataFramemyDictionary = {'R': 'Red', 'P': 'Purple', 'G': 'Green', 'Y': 'Yellow', 'W': 'White', 'B': 'Black'}
mySeries = Series(myDictionary)
mySeries.name = 'House'print(mySeries)
print(mySeries.values)
print(mySeries.index)OUTPUT:
R Red
P Purple
G ... -
CODE
sales = 150, 180, 200, 90, 135, 98, 'Yet to receive'
print(sales)
OUTPUT
(150, 180, 200, 90, 135, 98, 'Yet to receive')CODE
sales_list = list(sales)
sales_list.append(100)
print(sales_list)OUTPUT
[150, 180, 200, 90, 135, 98, 'Yet to receive', 100] -
James Stamp made a comment
Code:
firstName = 'Lauren'
middleName = 'Hurrier'
lastName = 'Manual'
print(firstName + ' ' + middleName + ' ' + lastName)Output:
Lauren Hurrier Manual -
James Stamp made a comment
fruit = ('apple', 'banana', 'grape')
print(fruit)
('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.
-
James Stamp made a comment
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
-
James Stamp replied to James Stamp
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 >
-
James Stamp made a comment
Eventually got it working.
Code here for server and client files here <https://pastebin.com/XYPK6SAx>
-
James Stamp made a comment
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.
-
James Stamp made a comment
A very fascinating video. Really good to see.
-
James Stamp made a comment
A very interesting week. The presentation of the material is excellent.
-
James Stamp made a comment
Really good video. It's amazing how much you can do with only a few lines of code.
-
James Stamp made a comment
I found the computerphile video is very informative. Well worth watching
-
James Stamp made a comment
This is really great content. Easy to understand and follow.
-
James Stamp made a comment
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.
-
James Stamp replied to James Stamp
Hi @Andreray, thanks for information about f / format. I’ll certainly check this out.
-
James Stamp made a comment
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.
-
James Stamp made a comment
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 = 0def __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
https://realpython.com/instance-class-and-static-methods-demystified/
-
James Stamp made a comment
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…
-
James Stamp made a comment
Mini game here.
Two characters - populate the map, a Friend and an Enemy
Possible Actions - display, help, fight, talk, north, south, east, west, exitActions
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… -
James Stamp made a comment
Code for enemy class and the fight with Zach the Zombie
-
James Stamp made a comment
~~~
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 == ‘’:
polly.set_conversation(None)
polly.talk()
chat = False
else:
polly.set_conversation(comment)
… -
James Stamp made a comment
~~~
class Item():
def init(self,roomName):
#constructor
#object attributes
self.name = name
self.description = None
self.value = Nonedef set_name(self,name): self.name = name def get_name(self): return self.name def...
-
James Stamp made a comment
~~~
class Room():
def init(self,roomName):
#object attributes
self.name = roomName
self.description = None
self.items = None
self.exits = Nonedef set_description(self,description): self.description = description def get_description(self): return...
-
James Stamp made a comment
Methods
north, south, east, west, up, downAttributes
size, colour, descriptions, items, exits, description -
James Stamp made a comment
Code draws 20 shapes of random size, colour and position.
~~~
from shapes import Paper, Triangle, Rectangle, Oval
from random import randintdef getColour():
#return a random colour string
colours = [“red”,”orange”,”yellow”,”green”,”blue”,”indigo”,”purple”]
colour = colours[randint(0,6)]
return colourdef 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
-
James Stamp made a comment
I really enjoyable course. The exercises really helped in understanding the concepts presented. Thanks to all involved in producing and presenting the course.
-
James Stamp made a comment
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
-
James Stamp made a comment
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...
-
James Stamp made a comment
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...
-
James Stamp made a comment
One additional value that could be recorded after each round is the value chosen leading to the a win or defeat.
-
James Stamp made a comment
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...
-
James Stamp made a comment
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.
-
James Stamp made a comment
Updated RPG code to check health is between 0 and 5. Anything lower than 0 or higher than 5 is highlighted as cheating
-
James Stamp made a comment
-
James Stamp replied to Steve Seabrook
Hi @SteveSeabrook, to suppress the display of <class 'str'> <class 'float'>, remove or comment out the final print line.
-
James Stamp made a comment
RPG code with load and save functionality. Updated the showStatus code to display the possible directions from the current position
-
James Stamp made a comment
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
-
James Stamp replied to Steve Seabrook
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.
-
James Stamp made a comment
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)
-
James Stamp made a comment
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.