Pratap Vardhan https://pratapvardhan.com/ Recent content on Pratap Vardhan Hugo -- gohugo.io en-us Mon, 09 Oct 2023 00:00:00 +0000 Git: Finding Exact Line Numbers Changed in Recent Commits https://pratapvardhan.com/notes/bash/git-exact-line-numbers-changes/ Fri, 06 Jun 2025 02:00:00 +0000 https://pratapvardhan.com/notes/bash/git-exact-line-numbers-changes/ Git, Sometimes you need more than just a list of changed files, you need to know exactly which lines were modified. how to use Git and AWK to extract precise line ranges from the last 5 commits. git diff HEAD~5..HEAD -U0 | awk ' /^\+\+\+ b\// { file = substr($0, 7) } /^@@/ { gsub(/.*\+/, "", $3); gsub(/[^0-9,].*/, "", $3); split($3, a, ","); start = a[1]; count = (a[2] ? a[2] : 1); end = start + count - 1; print file ": " start "-" end }' output will be something like: Turn browser tab into a Notepad https://pratapvardhan.com/notes/browser/note-taking/ Tue, 22 Oct 2024 00:00:00 +0000 https://pratapvardhan.com/notes/browser/note-taking/ Use your browser as a quick, simple notepad by entering this in the address bar: data:text/html, <title>Text Editor</title> <h2>Notes</h2> <body contenteditable style="font-size:1rem;font-family:Helvetica; line-height:1.4;max-width:60rem; margin:0 auto;padding:4rem;"> Convert images to gif https://pratapvardhan.com/notes/bash/convert-images-to-gif/ Sat, 12 Oct 2024 10:20:00 +0000 https://pratapvardhan.com/notes/bash/convert-images-to-gif/ #!/bin/bash # input images pattern input_images="*.png" output_gif="output.gif" # delay between frames (100 = 1 second) delay=100 # loop forever (0), or specify number of loops loop=0 # create GIF using ImageMagick's convert convert -delay $delay -loop $loop $input_images $output_gif examples convert -delay 20 -loop 0 "*.jpeg" output.gif convert -delay 20 -loop 0 1.jpeg 2.jpeg output.gif convert: ImageMagick command for image conversions. -delay: Sets the time each frame is displayed, measured in hundredths of a second. python environments https://pratapvardhan.com/notes/python/python-environments/ Tue, 17 Sep 2024 02:00:00 +0000 https://pratapvardhan.com/notes/python/python-environments/ Use pyenv to switch between Python versions. Use venv for creating of virtual environments. pyenv versions pyenv version python --version # install a version pyenv install 3.10 # select just for current shell session pyenv shell <version> # automatically select whenever you are in the current directory (or its subdirectories) pyenv local <version> # select globally for your user account pyenv global <version> # uninstall pyenv uninstall <versions> Use venv for creating of virtual environments. git – set your commit email address in folders https://pratapvardhan.com/notes/bash/git-set-config-email/ Mon, 16 Sep 2024 02:00:00 +0000 https://pratapvardhan.com/notes/bash/git-set-config-email/ You can use git config user.email to set a different email address from global one for each folder. Here’s a bash snippet. #!/bin/bash # Define the root directory containing all your folders ROOT_DIR="/path/to/your/directories" # Define the email you want to set for each Git repository GIT_EMAIL="[email protected]" # Loop through each folder in the root directory for dir in "$ROOT_DIR"/*; do if [ -d "$dir" ]; then cd "$dir" # Check if the folder is a Git repository if [ -d ". python code checks https://pratapvardhan.com/notes/python/code-checks/ Mon, 16 Sep 2024 02:00:00 +0000 https://pratapvardhan.com/notes/python/code-checks/ Some code checks I do while reviewing python code. # Using [] instead of generator expressions grep -rn --exclude-dir=venv --include="*.py" '\(sum\|min\|max\|any\|all\|list\|tuple\|set\)(\[.*\])' . # Using range(len(...)) instead of enumerate() grep -rn --exclude-dir=venv --include="*.py" 'for .* in range(len(.*))' . # Using == to compare with None, True, False instead of is grep -rn --exclude-dir=venv --include="*.py" -E '== *(None|True|False)' . # Using + to concatenate strings in a loop grep -rn --exclude-dir=venv --include="*.py" -E 'for . Run a Script on Startup in Linux https://pratapvardhan.com/notes/bash/server-startup-script/ Thu, 08 Aug 2024 10:20:00 +0000 https://pratapvardhan.com/notes/bash/server-startup-script/ To add a startup script on Linux that runs whenever the server is started or restarted, using systemd First, your /path/to/startup_script.sh #!/bin/bash # Your commands here echo "Server started at $(date)" >> /var/log/server_start.log # Add any other startup tasks you need make the script executable sudo chmod +x /path/to/startup_script.sh Create a new file in systemd service file sudo nano /etc/systemd/system/startup_script.service with following content [Unit] Description=Startup Script After=network.target [Service] ExecStart=/path/to/startup_script.sh User=root [Install] WantedBy=multi-user. BigQuery - Sampling https://pratapvardhan.com/notes/sql/bigquery-table-sample/ Sun, 21 Jul 2024 10:20:00 +0000 https://pratapvardhan.com/notes/sql/bigquery-table-sample/ Table sampling allows you to query subsets of large BigQuery tables, providing diverse records and reduces the cost of scanning the entire table. This query ~selects 10% of a data: SELECT * FROM dataset.table TABLESAMPLE SYSTEM (10 PERCENT) https://cloud.google.com/bigquery/docs/table-sampling python: line by line profiling (time, memory) https://pratapvardhan.com/notes/python/line-profiling/ Sun, 14 Apr 2024 00:00:00 +0000 https://pratapvardhan.com/notes/python/line-profiling/ Line-By-Line Profiling with %lprun pip install line_profiler In notebook %load_ext line_profiler %lprun -f slow_func slow_func(value) Timer unit: 1e-09 s Total time: 0.000134558 s File: /tmp/ipykernel_70058/363435982.py Function: slow_func at line 1 Line # Hits Time Per Hit % Time Line Contents ============================================================== 1 def slow_func(numbers): 2 1 1441.0 1441.0 1.1 filtered_numbers = [] 3 101 42213.0 418.0 31.4 for num in numbers: 4 100 54900.0 549.0 40.8 if num % 2 ! GCP GCloud commands cheatsheet https://pratapvardhan.com/notes/gcp/gcp-commands-cheatsheet/ Sat, 30 Mar 2024 00:00:00 +0000 https://pratapvardhan.com/notes/gcp/gcp-commands-cheatsheet/ # list disks gcloud compute disks list # increase size of existing disk gcloud compute disks resize DISK_NAME --size=30GB --zone=us-central1-a # list zones gcloud compute zones list # describe VM config gcloud compute instances describe VM_NAME --zone=us-central1-a # reserve IP gcloud compute addresses create IP_NAME --addresses=IP --region=us-central1 ref 1 python: read files in parallel and merge them https://pratapvardhan.com/notes/python/read-files-parallel-merge/ Fri, 29 Mar 2024 00:00:00 +0000 https://pratapvardhan.com/notes/python/read-files-parallel-merge/ Given an iterable of csv files, pandas read and concatenate them import pandas as pd from multiprocessing import Pool files = folderPath.glob('*.csv') with Pool() as pool: df = pd.concat(pool.map(pd.read_csv, files)) To see progress, use tqdm to wrap the input files files = list(folderPath.glob('*.csv')) with Pool() as pool: df = pd.concat(pool.map(pd.read_csv, tqdm(files, total=len(files)))) You can use ThreadPoolExecutor to achieve the same thing. from concurrent.futures import ThreadPoolExecutor with ThreadPoolExecutor() as pool: df = pd. FFmpeg - Convert MOV video to MP4 https://pratapvardhan.com/notes/ffmpeg/mov-to-mp4/ Mon, 20 Nov 2023 00:00:00 +0000 https://pratapvardhan.com/notes/ffmpeg/mov-to-mp4/ FFmpeg command to convert MOV video to MP4 video: ffmpeg -i input.mov \ -vf "scale=-1:720" \ -c:v libx264 \ -crf 23 \ -c:a aac \ -b:a 192k \ output.mp4 This will convert mov to mp4 by scaling the video to 720 pixels height maintaining original aspect ratio, compresses the video using libx264 codec with 23 CRF, compresses audio using aac codec with 192 kbps bitrate Bucketlist https://pratapvardhan.com/bucketlist/ Mon, 09 Oct 2023 00:00:00 +0000 https://pratapvardhan.com/bucketlist/ This is a short list of things I want to do this year. Use this to commit publicly and find collaborators 😊 Visual Storytelling Data stories from India Data videos Machine Learning LLMs Geospatial applications MLOps Read more. (economics, psychology, history and design) Interested to collaborate? Drop me a note! About > Pratap Vardhan https://pratapvardhan.com/about/ Sun, 01 Oct 2023 18:32:01 +0200 https://pratapvardhan.com/about/ A bit about Pratap ~ I’m a full-stack data science engineer from India. I build interfaces, to help people tell stories using technology and data. I’m a principal data scientist at Khan Academy and creator of Stats of India You can read more about my work here. To get in touch with me see contact. Work I spend most of my time with data, code & stories. Some of my work is here and twitter. Book Summary: Factfulness: Ten Reasons We're Wrong About the World – and Why Things Are Better Than You Think – Hans Rosling https://pratapvardhan.com/bookshelf/factfulness-hans-rosling/ Fri, 12 May 2023 00:00:00 +0000 https://pratapvardhan.com/bookshelf/factfulness-hans-rosling/ Ten instincts distort our perspective of the world and prevent us from seeing how it actually is. Think about the world. War, violence, natural disasters, man-made disasters, corruption. Things are bad, and it feels like they are getting worse, right? The rich are getting richer and the poor are getting poorer; and the number of poor just keeps increasing; and we will soon run out of resources unless we do something drastic. FFmpeg - Convert MP4 video to GIF https://pratapvardhan.com/notes/ffmpeg/mp4-to-gif/ Tue, 09 May 2023 00:00:00 +0000 https://pratapvardhan.com/notes/ffmpeg/mp4-to-gif/ FFmpeg command to convert an MP4 video to a GIF file: ffmpeg -i input.mp4 \ -filter_complex \ "[0:v] fps=10,scale=320:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse" \ output.gif This will create a GIF with a maximum width of 320 pixels and a maximum height proportional to the input aspect ratio, with a frame rate of 10 frames per second. -i input.mp4: Specifies the input video file. -filter_complex: For using complex filtergraphs to modify the video stream. BigQuery - calculating median https://pratapvardhan.com/notes/sql/bigquery-median/ Sat, 22 Apr 2023 10:20:00 +0000 https://pratapvardhan.com/notes/sql/bigquery-median/ You can use PERCENTILE_CONT and PERCENTILE_DISC to calculate ~median. However, it doesn’t work as aggregate function in GROUP BY. APPROX_QUANTILES comes handy here using APPROX_QUANTILES(column, 100)[OFFSET(50)] SELECT APPROX_QUANTILES(x, 100)[OFFSET(50)] AS median FROM UNNEST([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) AS x; BigQuery - Set date to April 1st based on current date https://pratapvardhan.com/notes/sql/bigquery-set-date-april/ Wed, 19 Apr 2023 10:20:00 +0000 https://pratapvardhan.com/notes/sql/bigquery-set-date-april/ When you need to set start_date to current financial year’s starting date. 2023-02-14 set to 2022-04-01 2023-10-34 set to 2023-04-01 DECLARE start_date DATE DEFAULT CURRENT_DATE(); SET start_date = DATE( IF( EXTRACT(MONTH FROM start_date) < 4, EXTRACT(YEAR FROM start_date) - 1, EXTRACT(YEAR FROM start_date) ), 4, 1 ); SELECT start_date AS month; Book Summary: Fooled by Randomness - Nassim Nicholas Taleb https://pratapvardhan.com/bookshelf/fooled-by-randomness-nassim-taleb/ Sun, 25 Dec 2022 00:00:00 +0000 https://pratapvardhan.com/bookshelf/fooled-by-randomness-nassim-taleb/ Randomness, (chance, luck) influences our lives and work more than we realize. Mild success can be explained by skills and labor. Wild success is attributable to variance. Because of hindsight bias, survivorship bias – we forget people who failed, remember only the few who succeed. And, make up reasons and patterns for their success even though it was largely random. Prologue At the cost of appearing biased, I have to say that the literary mind can be intentionally prone to the confusion between noise and meaning, that is, between a randomly constructed arrangement and a precisely intended message. BigQuery - Quickly mock a table https://pratapvardhan.com/notes/sql/bigquery-mock-table/ Fri, 11 Nov 2022 10:20:00 +0000 https://pratapvardhan.com/notes/sql/bigquery-mock-table/ Sometimes to test queries, you might want to quickly mock tables like table_inplace. Here’s one way to do it. WITH table_inplace AS ( SELECT * FROM UNNEST([ STRUCT (1 AS num, 'Sun' AS name), (2, 'Moon'), (3, 'Mars'), (4,'Earth') ] ) ) SELECT * FROM table_inplace Book Summary: The Psychology of Money: Timeless Lessons on Wealth, Greed, and Happiness - Morgan Housel https://pratapvardhan.com/bookshelf/psychology-money-morgan-housel/ Mon, 04 Apr 2022 00:00:00 +0000 https://pratapvardhan.com/bookshelf/psychology-money-morgan-housel/ The premise of book – doing well with money has a little to do with how smart you are and a lot to do with how you behave. And behavior is hard to teach, even to really smart people. One, financial outcomes are driven by luck, independent of intelligence and effort. Financial success is not a hard science. It’s a soft skill, where how you behave is more important than what you know. rsync examples https://pratapvardhan.com/notes/bash/rsync/ Mon, 28 Feb 2022 10:20:00 +0000 https://pratapvardhan.com/notes/bash/rsync/ https://linux.die.net/man/1/rsync # rsync current directory to remote recursively rsync -azP --delete . root@remoteip:/mnt/ rsync -chavzP --stats source target rsync -avz /localpath/file root@remoteip:/path/ parameters -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X) -c, --checksum skip based on checksum, not mod-time & size -h, --human-readable output numbers in a human-readable format --delete delete extraneous files from dest dirs -z, --compress compress file data during the transfer -P same as --partial --progress -v, --verbose increase verbosity --stats give some file-transfer stats Book Summary: One Up On Wall Street: How to Use What You Already Know to Make Money in the Market by Peter Lynch https://pratapvardhan.com/bookshelf/one-up-on-wall-street-peter-lynch/ Sun, 13 Feb 2022 00:00:00 +0000 https://pratapvardhan.com/bookshelf/one-up-on-wall-street-peter-lynch/ PART I: PREPARING TO INVEST Introduction: The Advantages of Dumb Money The nice thing about investing in familiar companies such as L’eggs or Dunkin’ Donuts is that when you try on the stockings or sip the coffee, you’re already doing the kind of fundamental analysis that they pay Wall Street analysts to do. Visiting stores and testing products is one of the critical elements of the analyst’s job Media 📰 https://pratapvardhan.com/media/ Tue, 01 Jun 2021 18:32:01 +0200 https://pratapvardhan.com/media/ Some of my work gets mentioned in the media. I also like to write data driven articles with colleagues. Here are a few. How many Indians own a fridge, AC or a washing machine An accrued price: What determines the high costs of retail fuel in India? Animation: COVID-19 Daily Cases in India - The Hindu Coronavirus Tracker - The Hindu India’s female political leaders: Find out how your state fares - LiveMint Bellwethers: Assembly seats which reflect overall election winners - The Hindu Election math: What might have been, If Maharashtra’s alliances had remained in place - The Indian Express, [print] Charts: Break-ups or not, BJP would have come out on top in Maharashtra - Firstpost Credited articles New Lok Sabha has highest number of women MPs - The Hindu - The Hindu How many women MLAs in your State? India in 30 Maps https://pratapvardhan.com/blog/india-in-30-maps/ Tue, 30 Mar 2021 11:00:00 +0000 https://pratapvardhan.com/blog/india-in-30-maps/ 1. Visualizing the network formed by 8,697 🚉 railway stations in India. Made with geopandas, matplotlib 2. A day in the Indian Railways Network Animating Rajdhani trains 🚆 moving from and to New Delhi. Data: data.gov datameet. 3. Literacy in India Understanding the picture at district level from census data. Just over a quarter districts have literacy above 70%. data: Census 2021 4. Access to healthcare Visualizing concentration of hospitals across India. 3D Population Density Maps of India https://pratapvardhan.com/blog/3d-population-density-maps-india/ Mon, 29 Mar 2021 00:00:00 +0000 https://pratapvardhan.com/blog/3d-population-density-maps-india/ Population density maps provide fascinating insights into how people are distributed across a country. Using data from the WorldPopProject, we took a closer look at India 🇮🇳. Annotated map The map reveals the “usual suspects” when it comes to high-density areas. Uttar Pradesh and Bihar dominate as the most densely populated regions, while Delhi and its surrounding areas—extending into Haryana and Uttar Pradesh also stand out. South India South India showcases intriguing patterns. Cartoonizer with TensorFlow.js https://pratapvardhan.com/blog/cartoonizer-with-tensorflowjs/ Sun, 28 Mar 2021 00:00:00 +0000 https://pratapvardhan.com/blog/cartoonizer-with-tensorflowjs/ Try application I used Generative Adversarial Network (GAN) model proposed in Learning to Cartoonize Using White-box Cartoon Representations (CVPR 2020) by Xinrui Wang and Jinze Yu. The idea was to test if it is reasonably possible to perform model inferences in the browser clients with CPUs only. Without needing to send any of user’s data (images) to servers. App preview: Upload an image or try examples Here’s the application flow and architecture: Recent Evolution of India's Lower Judiciary https://pratapvardhan.com/blog/india-lower-judiciary/ Sat, 27 Mar 2021 00:00:00 +0000 https://pratapvardhan.com/blog/india-lower-judiciary/ Cases are being decided faster in Indian lower courts but at the same time case load is increasing too. When we look at the data of 38 million cases filed between 2013-2016 in lower courts, we can see. % of cases being decided within 2 years has improved in UP, Bihar & Chhattisgarh But cases filed per 1L population has > doubled in Kerala, Haryana, UP, Delhi and few others NCR: Increasing case loads States around the NCR region are seeing increase in cases being filed, and % of cases decided within 2 years is getting plateaued around 80% Frequently used Bash Commands https://pratapvardhan.com/notes/bash/common-bash-commands/ Mon, 22 Mar 2021 10:20:00 +0000 https://pratapvardhan.com/notes/bash/common-bash-commands/ # find first level js, and grep find */*.js -print0 | xargs -0 grep --color 'treemap' # find lines of code find */*.html *.html -print0 | xargs -0 wc -l -c # Search word in files grep -rnw '/path/to/somewhere/' -e 'pattern' grep -nR --include="*.py" -E "work" "/path/" # with depth find -maxdepth 3 -path '*.py' -print0 | xargs -0 grep -n 'importlib' --color=always # List 10 last modified files ls -lht --time-style=full-iso /mnt/location/ | head -10 # or use subshell like (cd /mnt/location/ && ls -lht --time-style=full-iso | head -10) # Run command in background nohup jupyter notebook --listen. Using Django in Jupyter Notebook https://pratapvardhan.com/notes/django/using-django-in-jupyter-notebook/ Wed, 10 Mar 2021 10:20:00 +0000 https://pratapvardhan.com/notes/django/using-django-in-jupyter-notebook/ To explore your Django models in Jupyter Notebook, you can use the following setup. Install django-extensions pip install django-extensions Include django-extensions in your settings INSTALLED_APPS += ['django_extensions'] Start Django server python manage.py shell_plus --notebook Then, I usually add DJANGO_ALLOW_ASYNC_UNSAFE to debug locally. Not recommended on production databases. import os os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true" Now import your django models from app.models import User for user in User. Book Summary: Digital Minimalism: Choosing a Focused Life in a Noisy World - Cal Newport https://pratapvardhan.com/bookshelf/digital-minimalism-cal-newport/ Sat, 13 Feb 2021 00:00:00 +0000 https://pratapvardhan.com/bookshelf/digital-minimalism-cal-newport/ Digital Minimalism A philosophy of technology use in which you focus your online time on a small number of carefully selected and optimized activities that strongly support things you value, and then happily miss out on everything else. Define your technology values: Is this technology the best way to support this value? How am I going to use this technology going forward to maximize its value and minimize its harms? Nifty 100 reaction to Budget 2021 https://pratapvardhan.com/blog/nifty-budget2021/ Tue, 02 Feb 2021 10:20:00 +0000 https://pratapvardhan.com/blog/nifty-budget2021/ Stock markets seem to have liked the Budget 2021 today. In Nifty 100, only 13 companies went red. Most of these 13 are from Consumer Goods and Pharma sector. 🔻 Dr Reddys down -3.7%. UPL biggest loser -5% Bajaj Finserv, IndusInd, SBI, ICICI moved +10% Automobile, Energy were in net positive too 🎬 Play the animation below to see Nifty 100 companies movements during the Budget day. You might also like this post on Nifty 100 Companies Performance in 2020 Home https://pratapvardhan.com/home/ Mon, 04 Jan 2021 18:32:01 +0200 https://pratapvardhan.com/home/ Hi! I’m Pratap. 👋 I’m a full-stack data science engineer from India. I build interfaces, to help people tell stories using technology and data. I’m a principal data scientist at Khan Academy and creator of Stats of India You can read more about my work here. To get in touch with me see contact. Recent Tensorflow: TFCommunitySpotlight Winner for in-browser photo cartoonizer Talk: How we built covid19dashboards.com at JupyterCon Interactive: Capacity Planning: Simulate hospital beds availability Article: Bar Chart Race in Python with Matplotlib - Towards Data Science Article: Tile Narrative: Scrollytelling with Grid Maps - Nightingale, Data Visualization Society Article: Lessons Learned From Creating Physical Data Visualizations - Nightingale, DVS See more Recent [Archive News] https://pratapvardhan.com/recent/ Mon, 04 Jan 2021 18:32:01 +0200 https://pratapvardhan.com/recent/ Tensorflow: TFCommunitySpotlight Winner for in-browser photo cartoonizer Talk: How we built covid19dashboards.com at JupyterCon Talk: Tile Narrative: Scrollytelling with Grid Maps at IEEE VIS VisComm Talk: Geospatial visualizations with matplotlib at SciPy India Media: Animation: COVID-19 Daily Cases in India in The Hindu Media: Coronavirus Tracker in The Hindu Dataset: NFHS-5: CSV fact sheets for National Family Health Survey (2019-20) Dataset: PMGSY Rural Facilities Dataset 2020: 770K geo-tagged rural facilities in India Article: Tile Narrative: Scrollytelling with Grid Maps - Nightingale, Data Visualization Society Interactive: Tile Narrative: Understanding Community Mobility in the United States Interactive: COVID19 Tracker: Tracking the spread of the Coronavirus Interactive: Capacity Planning: Simulate hospital beds availability Article: Bar Chart Race in Python with Matplotlib - Towards Data Science Article: Lessons Learned From Creating Physical Data Visualizations - Nightingale, Data Visualization Society Interactive: BoxOffice: Who are The Highest-Grossing Actors of All-Time at The Box Office? Work https://pratapvardhan.com/work/ Mon, 04 Jan 2021 18:32:01 +0200 https://pratapvardhan.com/work/ I help build products, libraries and tools to make sense of data. In my work, I talk to people to identify problems, data sources and outcomes clean, analyze and communicate insights from data identify technology, algorithms and frameworks to solve problems develop and deploy machine learning models automate patterns of insights and product-ize reusable components build scalable data applications I use Python, R, SQL for data (analysis, engineering) JavaScript (interactive web applications) stats, machine learning, visual storytelling I leverage and contribute to open-source projects. 2020 Nifty 100 Companies Performance https://pratapvardhan.com/blog/2020-nifty100-performance/ Thu, 31 Dec 2020 10:20:00 +0000 https://pratapvardhan.com/blog/2020-nifty100-performance/ In 2020, NIFTY 100 stock index gave a return of 14.8%. Of the 100 companies, 70 ended in gains and 30 🔻 in loses. When you look at the sectors split - all the stocks from Pharma and IT had positive returns. Financial services in general didn’t have a great year. In total 4 stocks had 100%+ returns – Aurobindo Pharma (102%), Larsen & Toubro Infotech (108%), Divi’s Laboratories (112%) and Adani Green Energy (502%). Export LinkedIn Posts Statistics https://pratapvardhan.com/blog/export-linkedin-posts-data/ Mon, 28 Dec 2020 00:00:00 +0000 https://pratapvardhan.com/blog/export-linkedin-posts-data/ It turns out LinkedIn doesn’t have an easy way to export data on your published posts (views, likes, comments and yada). (yet!) LinkedIn posts page With below steps, you can export your data: Goto https://www.linkedin.com/in/[YOUR-NAME-HERE]/detail/recent-activity/shares/ Scroll to the bottom of the page, and keep scrolling till you reach the posts you want to export Open Chrome devtools (Ctrl+Shift+I) and goto console tab. (or any browser) Run below javascript code let data = Array. Talks 💬 https://pratapvardhan.com/talks/ Sun, 20 Dec 2020 18:32:01 +0200 https://pratapvardhan.com/talks/ I try to regularly speak at events related to data. Some of these are recorded and available online. How we built covid19dashboards.com at JupyterCon 2020 Tile Narrative: Scrollytelling with Grid Maps at IEEE VIS VisComm 2020 Geospatial visualizations with matplotlib at SciPy India 2020 Exploratory Spatial Data Analysis with Python at Azure DataFest, Oct 2019 Visualizing flood propagation with OSM and DEM at State of the Map Asia, Nov 2018 APIs and Web Scraping on Cloud at JNTUH Workshop on Data Science Hyderabad Dec, 2017 Data Visualization - Finding Pictures in Numbers at ConvergeConf Kakinada Dec, 2017 Advanced Analytics - Panel discussion. Publications https://pratapvardhan.com/publications/ Tue, 01 Dec 2020 18:32:01 +0200 https://pratapvardhan.com/publications/ You could read them on Google Scholar. Majumdar, Kaushik Kumar, and Pratap, Vardhan. “Automatic seizure detection in ECoG by differential operator and windowed variance”.IEEE Transactions on Neural Systems and Rehabilitation Engineering 19, no.4 (2011): 356–365. Rajashekara, HM, Pratap, Vardhan, and BS Daya, Sagar. “Generation of zonal map from point data via weighted skeletonization by influence zone”.IEEE Geoscience and Remote Sensing Letters 9, no.3 (2011): 403–407. Vardhan, Pratap, and Kaushik, Majumdar. Tile Narrative: Unemployment in the US https://pratapvardhan.com/blog/us-unemployment-2020/ Thu, 03 Sep 2020 00:00:00 +0000 https://pratapvardhan.com/blog/us-unemployment-2020/ The US unemployment rate peaked at 14.7% in April 2020, the highest rate since the Great Depression. In June, 20 states had unemployment rate higher than 10%, of which, 4 states had an unemployment rate over 15%. Tile Narrative: Unemployment in the United States I reused the tile narrative format for this interactive to understand how the COVID-19 pandemic has affected employment levels across the United States. DeOldify: Colorize old photos https://pratapvardhan.com/blog/deoldify/ Sat, 15 Aug 2020 00:00:00 +0000 https://pratapvardhan.com/blog/deoldify/ As India celebrates 74th Independence Day, I attempted to colorize few photos from the 1940-50’s period. This is colorized photo from 15 August 1947 of Indian Flag hoisted at Chandni Chowk in New Delhi on Independence Day. (Original B&W photo). The second photo I colorized was originally taken in 1948 by Homai Vyarawalla (Dalda 13) of Independent India’s first Cabinet. Here’s a colorized photo with Jawaharlal Nehru with Sardar Patel, Rajaji, BR Ambedkar, Maulana Azad, Syama Mukherjee, Jagjivan Ram, Amrit Kaur, Matthai, Rafi Kidwai and Baldev Singh among others. Compare ImageNet CNN architectures https://pratapvardhan.com/blog/imagenet-sota/ Sun, 09 Aug 2020 00:00:00 +0000 https://pratapvardhan.com/blog/imagenet-sota/ Last week, I released a beginner’s utility to compare classification results from SotA Convolutional Neural Network architectures. Motivation for the tool was to enable beginners and non-programmers to “see” how off-the-shelf pre-trained deep learning models classify their own real-world images. These models wouldn’t necessarily work well across all your images and meant to be more of an educational tool. Under the hood, it uses pre-trained MobileNetV2, ResNet50, VGG19, InceptionV3, Xception weights from TensorFlow Keras Tile Narrative: Scrollytelling with Grid Maps https://pratapvardhan.com/blog/tile-narrative/ Sat, 18 Jul 2020 00:00:00 +0000 https://pratapvardhan.com/blog/tile-narrative/ Republished on Data Visualization Society’s Nightingale While choropleth maps are the go-to method to visualize geographic data, they tend to skew attention towards the bigger states (blocks). Some data stories need equal emphasis for each block (state) and be arranged in a way that is close to the actual map representation. That is where tile grid maps shine. As Danny DeBelius points out, they can be the perfect way to avoid the visual imbalances typical to traditional choropleths. Book Summary: Influence: The Psychology of Persuasion Robert B. Cialdini https://pratapvardhan.com/bookshelf/influence-psychology-persuasion-robert-cialdini/ Sat, 13 Jun 2020 00:00:00 +0000 https://pratapvardhan.com/bookshelf/influence-psychology-persuasion-robert-cialdini/ The book is organized around these six principles, one to a chapter. The principles—consistency, reciprocation, social proof, authority, liking, and scarcity—are each discussed in terms of their function in the society and in terms of how their enormous force can be commissioned by a compliance professional who deftly incorporates them into requests for purchases, donations, concessions, votes, assent, etc. The evidence suggests that the ever-accelerating pace and informational crush of modern life will make this particular form of unthinking compliance more and more prevalent in the future. Bar Chart Race in Python with Matplotlib https://pratapvardhan.com/blog/bar-chart-race-python-matplotlib/ Wed, 04 Sep 2019 00:00:00 +0000 https://pratapvardhan.com/blog/bar-chart-race-python-matplotlib/ ~In roughly less than 50 lines of code Republished on towardsdatascience Bar chart races have been around for a while. This year, they took social media by storm. It began with Matt Navarra’s tweet, which was viewed 10 million times. Then, John Burn-Murdoch created reproducible notebook using d3.js, others started creating their races. Then, Flourish studio released race chart for non-programmers. Since then hundreds of races have been shared on the Internet. FT Visual Vocabulary with Vega https://pratapvardhan.com/blog/ft-visual-vocabulary-vega/ Mon, 25 Mar 2019 00:00:00 +0000 https://pratapvardhan.com/blog/ft-visual-vocabulary-vega/ There are many ways to visualize data - how do we know which chart to pick? Visual Vocabulary guide from The Financial Times’s Graphics team is one answer was created to help their team to pick the right type of visualization for their story. 72+ charts types are divided into 9 categories deviation, correlation, ranking, distribution, change over time, magnitude, part-to-whole, spatial and flow. Vega Edition Last month, I started building these charts in Vega 2018 India State Elections Explorables https://pratapvardhan.com/blog/2018-india-state-elections-enumter-gramener/ Sat, 15 Dec 2018 00:00:00 +0000 https://pratapvardhan.com/blog/2018-india-state-elections-enumter-gramener/ Richie Lionell, Bhanu K and I decided to spend our last weekend to create explorable stories for the recently concluded Indian state elections (Madhya Pradesh, Telangana, Chhattisgarh, Mizoram and Rajasthan). Interactives This resulted in creation of a single page with 3 components. Overview: section has a stacked bar with winner, runner-up, half-way indictor, vote-shares and narrative text. Map: zoom-able, search-able map visual with constituency details on tooltip Table: sortable, searchable table with vote-share, margin, NOTA details Contact https://pratapvardhan.com/contact/ Sat, 01 Dec 2018 18:32:01 +0200 https://pratapvardhan.com/contact/ You can contact me via email pratapapvr[@]gmail.com To Speak If you’re inviting me to speak at an event, please send me an email about the topic, venue and dates. To Collaborate If you’re interested to collaborate with me, please send me an email with your intent and interests.