This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################### Scraping Bdjobs.com ############################################## | |
# For selecting css elements, I have used the Chrome Extension "SelectorGadget" along | |
# with the "rvest" (version: 0.3.2) and "xml2" packages. | |
# Machine Info : | |
# R version 3.2.3 (2015-12-10) | |
# Platform: x86_64-w64-mingw32/x64 (64-bit) | |
# Running under: Windows 7 x64 (build 7600) | |
# To check yours type version OR sessionInfo() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Please Upload this file to the server. | |
http://extratorrent.cc/torrent/5291977/Udemy+-+Case+Studies+in+Data+Mining+with+R.html | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Printing prime numbers upto a certain number | |
def is_prime(num): | |
for i in range(2, num): | |
if (num % i) == 0: | |
return False | |
return True | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calculating Area for Rectangle and Circle | |
import math | |
def get_area(shape): | |
shape = shape.lower() | |
if shape == "rectangle": | |
rectangle_area() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reading a text file | |
# Steps: | |
filename = "Huck_finn.txt" | |
file = open(filename, mode = "r") | |
text = file.read() | |
print(text) | |
print(file.closed) # returns boolean value; indicates that the file is closed or not. | |
file.close() # closes the file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################## Importing Data in Python (Part 2) ############################################# | |
########################################## Importing flat files from the web: your turn! ################################# | |
# You are about to import your first file from the web! The flat file you will import will be 'winequality-red.csv' from the University # of California, Irvine's Machine Learning repository. The flat file contains tabular data of physiochemical properties of red wine, | |
# such as pH, alcohol content and citric acid content, along with wine quality rating. | |
# The URL of the file is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################################### Loading and viewing your data ########################################### | |
# In this chapter, you're going to look at a subset of the Department of Buildings Job Application Filings dataset from the NYC Open | |
# Data portal. (https://opendata.cityofnewyork.us/) This dataset consists of job applications filed on January 22, 2017. | |
# Your first task is to load this dataset into a DataFrame and then inspect it using the .head() and .tail() methods. However, you'll | |
# find out very quickly that the printed results don't allow you to see everything you need, since there are too many columns. |