Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/feed-rss2.php on line 8
‘#mastery30’ Articles at TC101 Fall 2015 https://kenscourses.com/tc101fall2015 Introduction to Programming Python and C++ Thu, 26 Nov 2015 05:51:32 +0000 en hourly 1 https://creativecommons.org/licenses/by/4.0/ Mastery30 – Visualization of Data with tools https://kenscourses.com/tc101fall2015/2015/mastery30-visualization-of-data-with-tools/ Thu, 26 Nov 2015 05:51:32 +0000 https://ricardonewton.withknown.com/2015/mastery30---visualization-of-data-with-tools

Hello this is about the usage of visualization with tools, I  found on the internet there were some libreries that helped with this and the best 5 were:

1. D3

2. Vega

3.Procesing

4.Gephi

"For people just starting out, I'd suggest starting either with Processing or D3," says Jan Willem Tulp. "Both of them have a very large user base and a great number of examples you can learn from." 

The online data visualization community can be good for answering questions.  Statisticians may know data, but still be learning the basics of design. Designers may know how to create something that’s aesthetically pleasing, but still be learning about statistics.

So, be sure you select the one you like the best and fulfills all your needs. Some may say java is good too so you can try that one. It is better if you search on google for what you will be needing and be sure it makes all the things you need it to.

 

]]>

Hello this is about the usage of visualization with tools, I  found on the internet there were some libreries that helped with this and the best 5 were:

1. D3

2. Vega

3.Procesing

4.Gephi

“For people just starting out, I’d suggest starting either with Processing or D3,” says Jan Willem Tulp. “Both of them have a very large user base and a great number of examples you can learn from.” 

The online data visualization community can be good for answering questions.  Statisticians may know data, but still be learning the basics of design. Designers may know how to create something that’s aesthetically pleasing, but still be learning about statistics.

So, be sure you select the one you like the best and fulfills all your needs. Some may say java is good too so you can try that one. It is better if you search on google for what you will be needing and be sure it makes all the things you need it to.

 

]]>
https://creativecommons.org/licenses/by/4.0/
Mastery30 https://kenscourses.com/tc101fall2015/2015/mastery30-2/ Thu, 26 Nov 2015 05:43:02 +0000 http://finntec.wordpress.com/?p=99 This is the masteries about

  • Reading and writing of files in Python

You can find my video here:

]]>
https://creativecommons.org/licenses/by/4.0/
Mastery 30: Files https://kenscourses.com/tc101fall2015/2015/mastery-30-files/ Thu, 26 Nov 2015 05:18:52 +0000 http://charliegdrummer.wordpress.com/?p=444 Continúa leyendo Mastery 30: Files]]> In terms of files external files to python, such as dat, text, cvs… files, the command that you use to open them is……………….. OPEN!!!!

open(“filename.extension”,”r or w”)

You put r if you are going to read the file

You put w if you want to write the file

There are others parameter you can type there, but those are the basics

So let’s start, I am going to use the 93car.dat.tx the Journal of Statistics Education gives us.

What I want to do, is to delete all those strange number to only left the brand of the car and rthe model

See the original file:

original fiel

And how I want it to end:

desired file

So let’s start

The first thing to do is to open the file in reading mode (that means r at the end of the parenthesis)  and to store aaaaalll the data inside a variable inside python, I called it text, after that close it.

open in read

Then I will open the file in writing mode to start modifying it, so first, I have to get rid of the even lines.

open in write

One way te start reading and changing the lines is with a for loop

for (any variable, I chose line) in (where you stored all the data, in my case is text)

for line in text:

That is the main loop, and since I want to get rid of the even lines, I am going to write the lines only if is even BEACUSE we count the first iteration as one, see that x?

after doing that, close it!

open your file, and you are going to see….. YES!

middle.PNG

You have just modified your first file from python!

Now, I don like all those number, so I want to errase them, I know all these numbers start on the position number 30 en every line, so starting over and doing the same process EXCEPT what is inside the for.

start over

You see, what we are going to do inside the for loop is to write each line, but cutted; you see that [0:29]? that means that it is only going to write from the first space to the 29th of each line

just cmodesadas

And now open your file…. and it has to look like this, you did it!

 

asdfas

As you can see, it is very easy, you just write up what you want

 

Github link

 

b1e0b19965f87e7b83b66070e394bb33

]]>
https://creativecommons.org/licenses/by/4.0/
Mastery 30 https://kenscourses.com/tc101fall2015/2015/mastery-30/ Wed, 25 Nov 2015 17:24:06 +0000 http://choza973.wordpress.com/?p=186 Reading and writing files in Python.

 

]]>
https://creativecommons.org/licenses/by/4.0/
Masteries 8 & 30 https://kenscourses.com/tc101fall2015/2015/masteries-8-30/ Wed, 25 Nov 2015 03:57:47 +0000 http://carminaperezguerrero.wordpress.com/?p=140 Python conventions (Zen of Python)

Reading and writing of files in Python

]]>
https://creativecommons.org/licenses/by/4.0/
Mastery30 – Reading and writing files https://kenscourses.com/tc101fall2015/2015/mastery30-reading-and-writing-files/ Tue, 24 Nov 2015 14:40:00 +0000 http://kenscourses.com/tc101fall2015/?guid=798ccaeca8b36e1d9e89443e9291c50f Reading files:
To read a file you should know this functions: open(“filename”,”r”) and filename.read()
The first one is used to open a file, read it and pass that information to a variable ( if you want) or to simply work with it directly.
The second one will just read a file, to use this function ou should have used the open function first like this:
a = open(“filename”) 
print (a.read()) 
As you can see im not using the “r” because that means that i read it at the same time i open it, if you just want to open the file but not read it right there and use that information for later you should do something like what i did above. This has a lot of functionalities if you mix this with strings manipulation. You look for a specific word, count the lines, the total words etc. Here is an aplication for that, this documento opens and reads a file and counts how many times the word “banana” is in it (WSQ14):
def process_file(filename):
    name = open(filename)
    content = name.read()
    list = content.split(” “)
    print (list)
    counter = 0
    for i in list:
        if i.lower() == “banana”:
            counter += 1
    print (counter)
process_file(“file.txt”)

To be sure that this file works correctly i must have a text file named “file” and be sure that each word written in it is separated by a space. If you noticed, reading a file is reading a file is really simple. Is just taking a value from a different file and assigning it to a varible, works like an input. What matters is how you control or process that information.

 Writing a file:
To write a file you have to use the same function as before but this time with a different parameter: open(“filename”,”w”)
This “w” thing will thell python that you want to edit/write the file, be careful because this will erase the content of that file and create a new file. To write a line use fout.write() and use as a parameter a string (or a variable with a string), when you are done use fout.close(). It is very important that you understand that the file will star writing in the last empty line. Here is an example:
 def process_file(filename):
    name = open(“filename”,”w”)

    a = “no”
    while a == “yes”:

       line = input(“Write here the new data”)
       fout.write(line)
       a = input(“want to close?”)
    fout.close() 
process_file(“file.txt”)

This function will add new strings to the “file.txt” document until the user decides to stop.

]]>
https://creativecommons.org/licenses/by/4.0/
Mastery 28 & 30 https://kenscourses.com/tc101fall2015/2015/mastery-28-30/ Tue, 24 Nov 2015 02:52:21 +0000 http://davidg2897.wordpress.com/?p=298 ]]> Mastery 28 – User input (text based) in Python (basic)

Here’s basically any WSQ we’ve done, in most of them user input is needed.

Capture

Mastery 30 – Reading and writing of files in Python

Here’s an example code I made to demonstrate I know how to write and read files in Python.

Capture

]]>
https://creativecommons.org/licenses/by/4.0/
MASTERY30 https://kenscourses.com/tc101fall2015/2015/mastery30/ Mon, 23 Nov 2015 02:34:09 +0000 http://luiscortestec.wordpress.com/?p=153 I KNOW HOW TO READ AND WRITE FILES IN PYTHON

Captura de pantalla 2015-11-22 a las 8.32.42 p.m.

Captura de pantalla 2015-11-22 a las 8.33.45 p.m.

]]>
https://creativecommons.org/licenses/by/4.0/
Reading and Writting Files on Python https://kenscourses.com/tc101fall2015/2015/reading-and-writting-files-on-python/ Fri, 18 Sep 2015 19:51:00 +0000 http://kenscourses.com/tc101fall2015/?guid=0fbae4f319bfdf784c7f8253a87e2e99      For opening a python file, first look for the file you want to open and make sure it is a Python File. You can prove this by seeing if it has the image of a python on it.



     All the files inside the circle are considered Python File. To continue with demonstration we will open the file with the name “Hello.py”. First, give it a right click. A new menu will open and you will select the following option:



     IDLE is included when you install Python so you should have it. This will help us read the file, edit it and run it whenever we want to. Once we select the option, a new window will open. In this window we can see the code and even edit if we want to.



      If we want to run it we just need to press F5 of select the following option



      After this, Python will open a shell that is currently running your program. This way you can make sure the program you read before works just fine



Reading and Writting Files on Python

]]>
     For opening a python file, first look for the file you want to open and make sure it is a Python File. You can prove this by seeing if it has the image of a python on it.


     All the files inside the circle are considered Python File. To continue with demonstration we will open the file with the name “Hello.py”. First, give it a right click. A new menu will open and you will select the following option:


     IDLE is included when you install Python so you should have it. This will help us read the file, edit it and run it whenever we want to. Once we select the option, a new window will open. In this window we can see the code and even edit if we want to.


      If we want to run it we just need to press F5 of select the following option

      After this, Python will open a shell that is currently running your program. This way you can make sure the program you read before works just fine


]]>
https://creativecommons.org/licenses/by/4.0/