Quantcast
Channel: Planet Sage
Viewing all articles
Browse latest Browse all 414

Vince Knight: My CSV python video gets 10000 views

$
0
0

So the other day I got the following notification on my phone:

This both terrified me and made me smile. It’s nice to think that a bunch of people have (hopefully) been helped with what I put together but also slightly worrying as I think I would be able to put together a much better video if I did it now.

Here it is:

The basic code I use in the video is:

importcsvout=open('data.csv','r')# Open a file in read modedata=csv.reader(out)# Initiate a csv reader object which will parse the datadata=[[row[0],eval(row[1]),eval(row[2])]forrowindata]# Read in the data and convert certain entries of each rowout.close()# Close the filenew_data=[[row[0],row[1]+row[2]]forrowindata]# Create some new dataout=open('new_data.csv','w')# Open a file in write modeoutput=csv.writer(out)# Initiate a csv writer object which will write the data in the correct format (csv)forrowinnew_data:# Loop through the dataoutput.writerow(row)# Write the row to fileout.close()# Close the file

There are a couple of other videos that are getting near that landmark, this is possibly my favourite of them:

The above video shows how to simulate a basic queue in Python. My Summer student James Campbell and I are working on something related at the moment.


Viewing all articles
Browse latest Browse all 414

Trending Articles