Sunday, August 9, 2015

Python - Index Page

Listing all the articles on this blog related to Python
Do refer to python tutorials for lots of more info.

Python - Introduction and Installation steps

Refer index page for Python at the following URL:
http://mylearningcafe.blogspot.in/2015/08/python-index-page.html

 
What is Python?
Python is a programming language widely used to write games or simple code (to extract details from URLs) etc. It lets you integrate systems effectively.

Where to download Python from?
Go to https://www.python.org/
Click on Downloads
Download Python 3.4.3

Installing steps:
Once the installer is downloaded, double click it and click on Run
Select "install for all users" and click Next




Select the folder where you want to Install and keep clicking Next

Once installed, you can see it installed in your  "Start > All Programs > Python 3.4"
Click on "IDLE Python 3.4 GUI"




Congratulations!! Python has been installed and we are ready to rumble.


Refer index page for Python at the following URL:
http://mylearningcafe.blogspot.in/2015/08/python-index-page.html

Sunday, August 2, 2015

R Programming - Reading from a csv file

Refer index page for R at the following URL:
http://mylearningcafe.blogspot.in/2015/07/r-programming-index-page.html 
 



Basic requirement would be to read data from a CSV file into a data frame.

Command to read from a csv file?
csv_file <-read.csv("file_name.csv",TRUE,",")

What are the input parameters?
The input parameters to the read.csv functionis
  • The file name from the working directory (or a full URL)
  • If the first line of the csv contains the header, use TRUE else FALSE
  • The delimiter. In case of csv its a comma (,)
How to find the working directory?
Use the command getwd()

How to change the working directory?
Use the setwd(dir) for the same
e.g setwd("C:/TestFolder")

 

I have saved the following csv in the working directory





To read the same, I will use the following command
csv_file <-read.csv("test.csv",TRUE,",")



Note that I have used the head and tail command to retrieve a snapshot (6 rows)

One can also use a URL to read a file

csv_file <-read.csv("file_url\file_name.csv",TRUE,",")


Refer index page for R at the following URL:
http://mylearningcafe.blogspot.in/2015/07/r-programming-index-page.html