Data Science Assignment 1
Data Science Assignment 1
Data Science Assignment 1
Homework 1
Harsh Desai(23205088)
February 2024
1 Yahoo Finance
import yfinance as yf
import mplfinance as mpf
from datetime import datetime, timedelta
1
2 PDF Scraping
import tabula as tb
import pandas as pd
from IPython.display import display
2
SGP 36 Singapore 339,998 NaN
MYS 37 Malaysia 336,664 NaN
BGD 38 Bangladesh 324,239 NaN
ZAF 39 South Africa 301,924 NaN
COL 40 Colombia 271,347 NaN
FIN 41 Finland 271,234 NaN
VNM 42 Vietnam 271,158 NaN
PAK 43 Pakistan 263,687 NaN
CHL 44 Chile 252,940 NaN
ROU 45 Romania 248,716 NaN
CZE 46 Czech Republic 243,530 NaN
PRT 47 Portugal 231,256 NaN
NZL 48 New Zealand 212,482 NaN
PER 49 Peru 202,014 NaN
IRN 50 Iran, Islamic Rep. 191,718 NaN
GRC 51 Greece 189,410 NaN
KAZ 52 Kazakhstan 169,835 NaN
IRQ 53 Iraq 167,224 NaN
UKR 54 Ukraine 155,582 a
HUN 55 Hungary 155,013 NaN
QAT 56 Qatar 146,374 NaN
DZA 57 Algeria 145,164 NaN
KWT 58 Kuwait 136,197 NaN
MAR 59 Morocco 112,871 c
ETH 60 Ethiopia 107,645 NaN
SVK 61 Slovak Republic 104,574 NaN
PRI 62 Puerto Rico 103,138 NaN
CUB 63 Cuba 103,131 NaN
KEN 64 Kenya 98,843 NaN
ECU 65 Ecuador 98,808 NaN
3
3 Crypto Punk Web Scrapping
import requests
from bs4 import BeautifulSoup
from urllib.parse import urljoin
# URL of the page to scrape
url = 'https://cryptopunks.app/cryptopunks/details/9'
# Extract information
# Example: Find the section that contains the attributes
attributes_section = soup.find('div', {'col-md-10 col-md-offset-1': 'row'})
attributes = soup.find_all('li') # Assuming each attribute is in a list item
print('Attributes:')
\begin{document}
4
\section*{Attributes}
\begin{itemize}[leftmargin=*]"""
latex_output += r"""
\end{itemize}
latex_output += r"""
\end{document}
"""
Cryptopunk 9
Attributes: This Punk has 3 attributes, one of 4501 with that many.