In [4]:
# This is the format that I am trying to replicate in my code:  <a href=" website ">  title </a><br />
# An example: 
# <a href="http://localhost:10080">SAS Studio</a><br />
In [5]:
# Importing important libraries
import pandas as pd
In [6]:
# Transferring my data from csv file into pandas dataframe

weblinks = pd.read_csv(r"C:\Users\BB\Documents\datascience\projects\websitelinking\weblinks.csv")
In [7]:
# This is to see the contents of the dataframe
weblinks.head()
Out[7]:
website title
0 https://github.com/danistefanovic/build-your-o... Build your own insert technology here
1 https://github.com/EbookFoundation/free-progra... Freely available programming books
2 https://github.com/ohmyzsh/ohmyzsh A delightful community driven with 1700 plus c...
3 https://github.com/jwasham/coding-interview-un... A complete computer science study plan to beco...
4 https://github.com/github/gitignore A collection of useful gitignore templates
In [8]:
# Making sure I get the code right
print('<a href=\"' + '\">' + '</a><br/>')
<a href=""></a><br/>
In [9]:
# Printing the whole dataframe
print(weblinks)
                                              website  \
0   https://github.com/danistefanovic/build-your-o...   
1   https://github.com/EbookFoundation/free-progra...   
2                  https://github.com/ohmyzsh/ohmyzsh   
3   https://github.com/jwasham/coding-interview-un...   
4                 https://github.com/github/gitignore   
5   https://github.com/donnemartin/system-design-p...   
6          https://github.com/public-apis/public-apis   
7    https://github.com/jlevy/the-art-of-command-line   
8   https://github.com/trekhleb/javascript-algorithms   
9   https://github.com/kamranahmedse/developer-roa...   
10  https://github.com/tirthajyoti/PyTorch_Machine...   

                                                title  
0               Build your own insert technology here  
1                  Freely available programming books  
2   A delightful community driven with 1700 plus c...  
3   A complete computer science study plan to beco...  
4          A collection of useful gitignore templates  
5   Learn how to design large scale systems Prep f...  
6   A collective list of free APIs for use in soft...  
7                Master the command line, in one page  
8   Algorithms and data structures implemented in ...  
9         Roadmap to becoming a web developer in 2020  
10    Machine learning Deep Learning CNN with PyTorch  
In [10]:
# Selecting for the first item
weblinks.iloc[0]
Out[10]:
website    https://github.com/danistefanovic/build-your-o...
title                  Build your own insert technology here
Name: 0, dtype: object
In [11]:
# Selecting for the second item
weblinks.iloc[1]
Out[11]:
website    https://github.com/EbookFoundation/free-progra...
title                     Freely available programming books
Name: 1, dtype: object
In [12]:
# Selecting for the third item
weblinks.iloc[2]
Out[12]:
website                   https://github.com/ohmyzsh/ohmyzsh
title      A delightful community driven with 1700 plus c...
Name: 2, dtype: object
In [13]:
# Learning the difference between loc and iloc
weblinks.loc[0]
Out[13]:
website    https://github.com/danistefanovic/build-your-o...
title                  Build your own insert technology here
Name: 0, dtype: object
In [14]:
# Selecting just for the websites
weblinks['website']
Out[14]:
0     https://github.com/danistefanovic/build-your-o...
1     https://github.com/EbookFoundation/free-progra...
2                    https://github.com/ohmyzsh/ohmyzsh
3     https://github.com/jwasham/coding-interview-un...
4                   https://github.com/github/gitignore
5     https://github.com/donnemartin/system-design-p...
6            https://github.com/public-apis/public-apis
7      https://github.com/jlevy/the-art-of-command-line
8     https://github.com/trekhleb/javascript-algorithms
9     https://github.com/kamranahmedse/developer-roa...
10    https://github.com/tirthajyoti/PyTorch_Machine...
Name: website, dtype: object
In [15]:
# Selecting just for the titles
weblinks['title']
Out[15]:
0                 Build your own insert technology here
1                    Freely available programming books
2     A delightful community driven with 1700 plus c...
3     A complete computer science study plan to beco...
4            A collection of useful gitignore templates
5     Learn how to design large scale systems Prep f...
6     A collective list of free APIs for use in soft...
7                  Master the command line, in one page
8     Algorithms and data structures implemented in ...
9           Roadmap to becoming a web developer in 2020
10      Machine learning Deep Learning CNN with PyTorch
Name: title, dtype: object
In [16]:
# Making sure the string is long enough so it will print the entire title or website
pd.set_option('max_colwidth', 400000)
In [17]:
# My desired end product
print('<a href=\"' + weblinks['website'] + '\">' + weblinks['title'] + '</a><br/>')
0                                                                                                                                                                                                                                                                                            <a href="https://github.com/danistefanovic/build-your-own-x">Build your own insert technology here</a><br/>
1                                                                                                                                                                                                                                                                                        <a href="https://github.com/EbookFoundation/free-programming-books">Freely available programming books</a><br/>
2     <a href="https://github.com/ohmyzsh/ohmyzsh">A delightful community driven with 1700 plus contributors framework for managing your zsh configuration Includes 200 plus optional plugins rails git OSX hub capistrano brew ant php python etc over 140 themes to spice up your morning and an autoupdate tool so that makes it easy to keep up with the latest updates from the community.</a><br/>
3                                                                                                                                                                                                                                                        <a href="https://github.com/jwasham/coding-interview-university">A complete computer science study plan to become a software engineer.</a><br/>
4                                                                                                                                                                                                                                                                                                      <a href="https://github.com/github/gitignore">A collection of useful gitignore templates</a><br/>
5                                                                                                                                                                                                                           <a href="https://github.com/donnemartin/system-design-primer">Learn how to design large scale systems Prep for the system design interview Includes Anki flashcards</a><br/>
6                                                                                                                                                                                                                                                                   <a href="https://github.com/public-apis/public-apis">A collective list of free APIs for use in software and web development</a><br/>
7                                                                                                                                                                                                                                                                                               <a href="https://github.com/jlevy/the-art-of-command-line">Master the command line, in one page</a><br/>
8                                                                                                                                                                                                                          <a href="https://github.com/trekhleb/javascript-algorithms">Algorithms and data structures implemented in JavaScript with explanations and links to further readings</a><br/>
9                                                                                                                                                                                                                                                                                      <a href="https://github.com/kamranahmedse/developer-roadmap">Roadmap to becoming a web developer in 2020</a><br/>
10                                                                                                                                                                                                                                                                            <a href="https://github.com/tirthajyoti/PyTorch_Machine_Learning">Machine learning Deep Learning CNN with PyTorch</a><br/>
dtype: object
In [ ]: