Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

SOCIAL NETWORK ANALYSIS

CSE4008

Lab Report

Done by
R. Sai Vighnesh

21MIS7157
Week:1-4
Data Visualization
Histogram:

Output:
Line graph:

Output:
Bar Plot:

Output:
Scatter Plot:

Output:

Area Plot:

Output:
Box Plot:

Output:
Week:5-6
Youtube Data Analysis
1)Importing necessary libraries:

2)Using API Key for accessing youtube data api

3)Function to fetch trending videos in india:

4) Function to print the details(like title,views,likes,comments) of video:

5)
6)Task 1: Total views of trending videos

Output:

7)Task 2:View count distribution

Output:

8)Task-3: Likes and comments analysis

Output:

9)Task-4: Longest trending video

Output:

10)Task-5: Capitalized word count


Output:

11)Task-6: Title Length analysis

Output:

12)Task-7: Most common words

Output:

13)Task-8: Top channels

Output:

14)Task-9: Video Categories


Output:

15)Task-10: Publishing time Analysis

Output:
WEEK: 7-8
Analyze the Facebook data for sentimental analysis
DATASET: “pseudo_facebook.csv”

A. LOAD THE PSEUDO_FACEBOOK.CSV DATASET.

B. PREPROCESS THE DATASET. FIND NULL VALUES, DUPLICATES PROCESS THOSE VALUES
OUTPUT:

C.MAKING A NEW COLUMN FOR DIFFERENT AGE GROUP

D.FIND MAX AGE OF A PERSON

OUTPUT:
E. DISPLAY THE AGE GROUPS ANALYZE ITS COUNT.

OUTPUT:

F. FIND WHICH AGE GROUP HAS THE HIGHEST NUMBER OF USERS

OUTPUT:

G. WHICH GENDER AGED HAS HIGHER NUMBER OF USERS


OUTPUT:

H.WHICH GENDER HAS THE GREATEST NUMBER OF FRIENDS USING SCATTER PLOT?

OUTPUT:
I.WHO HAS THE HIGHEST FRIEND COUNT? USING BAR PLOT

OUTPUT:
J.WHICH AGE GROUP HAS HIGHEST NUMBER OF LIKES RECEIVED? USING COUNT PLOT.

OUTPUT:

K.WHO RECEIVED THE GREATEST NUMBER OF LIKES AGED 18?

OUTPUT:
L.WHO MALE HAS THE HIGHEST NUMBER OF LIKES RECEIVED.

OUTPUT:
M.WHICH MONTH ARE FACEBOOK USERS BORN?

OUTPUT:
N.WHICH FEMALES AGE GROUPS HAS RECEIVED A GREATER NUMBER OF LIKES THROUGH MOBILE
AND WEB.

OUTPUT:
Week:9-10

Exploring scrapy, a python library


a)First creating a new project :
scrapy startproject snalab

This will create a snalab directory of the following contents:

The file structure of scrapy project.


b) Spiders are classes that you define and that Scrapy uses to scrape information
from a website
Creating our first spider : quotes_spider.py/ spiders/ snalab
from pathlib import Path
import
scrapy

class QuotesSpider(scrapy.Spider):
name = "quotes"
start_urls = [
"https://quotes.toscrape.com/page/1/",
"https://quotes.toscrape.com/page/2/",
] def parse(self,
response):
page = response.url.split("/")[-2]
filename = f"quotes-{page}.html"
Path(filename).write_bytes(response.body)
c) If we run the spider that we created:

We will be getting quotes-1.html and quotes-2.html files with the contents for
the respective urls as parse method instructs in quotes_spider.py:
d) let’s see the selection and extraction of data: running this command, scrapy
shell https://quotes.toscrape.com/page/1/ in cmd
e) Storing the scraped data:
using this command: scrapy crawl quotes -O quotes.json
This creates a quotes.json file: where it stores all the scraped data.

You might also like