Categories
General

The beauty of code

UBS trading desk – Before and After automation

The world is getting increasingly divided between 2 sets of people or between haves and have nots guys who can code and guys who can’t . There used to be a time when coding actually was very esoteric when you you had to learn some fairly complicated type driven languages, APIs were few and far between,cross-platform development was a mess and typically interface to the Internet was complicated through sockets and ports

The world has changed drastcally since I did my engineering more than a decade back. The languages which were earlier disparaged as scripting languages are actually ruling the roost now because the scripts can do everything that general purpose languages were supposed to do

I was particularly delighted with Python after coming from the C and C++ world where with just 3 lines of code I could open my computer to the Internet and play a music file online. This is magic for those who originated in C/C++ land

import vlc p=vlc.MediaPlayer("https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3") p.play()

With around 10 lines of code I can get a ton of data from websites like Amazon. Following code gives me more than 500 latest reviews of iPhone 11

import requests for i in range (1,50):
from bs4 import BeautifulSoup
 url_page = review_url+str(i)
 html_doc = requests.get(url_page).content
 soup = BeautifulSoup(html_doc,'html.parser')
 reviews = soup.select('span[data-hook="review-body"]')
 for r in reviews:
 review_list.append(r.text.strip()) review_list=[]
review_url = "https://www.amazon.in/New-Apple-iPhone-11-64GB/product-reviews/B08L8DV7BX/ref=cm_cr_arp_d_paging_btm_next_2?ie=UTF8&reviewerType=all_reviews&pageNumber="

To check what people are saying about camera in the reviews, a few more lines of code

from textblob import TextBlob
aspect_reviews = [review for review in review_list if "camera" in review]
pos_comments=neg_comments=0
for r in aspect_reviews:
blob = TextBlob(r)
for sentence in blob.sentences:
if "camera" in sentence:
if sentence.sentiment.polarity>0.2:
pos_comments +=1
else:
neg_comments +=1
break

Output:

Total reviews related to camera is 43 Positive comments: 27 Negative comments: 16

Quite a lot of people saying negative about the camera, probably not justifying the high price tag. I have done it for some common aspects like camera, display, battery, face recognition and the result is this chart. Viola, basic sentiment analysis done. Lot of negative comments probably not what one would expect.

Of course the full production code and writing completely built systems will take a bit of skill and practice and experience however to get started is fairly easy . it is particularly true for managers who can get supernormal returns with just a few lines of code.

There are vast applications of coding or even a bit of coding in many areas that we managers take manually for granted , following are just a few examples

· Business development — Trying to find thousands of right Contacts or leads on LinkedIn is as simple as writing a small script to scrape relevant Contacts with filters on and downloading to Excel . Many products exist like RocketReach, Hunter, Lusha where you can bulk upload profiles and get their contact details

· Customer understanding — Don’t need to rely on marketing agencies or survey methods to know what your customers are talking about . sentiment analysis on topics that you care about gives very reliable information

· Innovation and competitors — Scrape online portals and check what the new buzz words are , what key selling points your competitors are using

· In house ERP — Too much of system intelligence is based in spreadsheets. With only a bit of coding Using Google API or some no code tools like airtable one can build pretty scalable and intelligent ERP systems in house

This post will be too long(already is) if I start giving examples of each so I’ll be taking these coding examples in subsequent posts however this is just to show that there are is a long list of applications and development that middle managers can do on their own and add supernormal capabilities to their analysis

Would love to hear examples of manual tasks your organization is facing and where you think code can solve it