<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Azad Kshitij</title>
    <description>The latest articles on DEV Community by Azad Kshitij (@azadkshitij).</description>
    <link>https://dev.to/azadkshitij</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F469089%2Fca0d9b7d-6556-4f3d-9bbd-99882e4075c7.png</url>
      <title>DEV Community: Azad Kshitij</title>
      <link>https://dev.to/azadkshitij</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/azadkshitij"/>
    <language>en</language>
    <item>
      <title>Win+V forgets everything when Windows restarts. Here is what I use instead.</title>
      <dc:creator>Azad Kshitij</dc:creator>
      <pubDate>Mon, 16 Nov 2026 17:11:46 +0000</pubDate>
      <link>https://dev.to/azadkshitij/winv-forgets-everything-when-windows-restarts-here-is-what-i-use-instead-nbp</link>
      <guid>https://dev.to/azadkshitij/winv-forgets-everything-when-windows-restarts-here-is-what-i-use-instead-nbp</guid>
      <description>&lt;p&gt;Almost everyone has done this. Copy a phone number, a sentence from an email, a&lt;br&gt;
link, a tracking code, meaning to come back to it later. Then something else happens&lt;br&gt;
and the copy is forgotten. Twenty minutes later the text is needed, and it is&lt;br&gt;
still in the clipboard, so all is well.&lt;/p&gt;

&lt;p&gt;The next morning it is gone.&lt;/p&gt;

&lt;p&gt;Windows was not built to hold on to copied text. Win+V gives you a clipboard&lt;br&gt;
history, but a restart clears it. The conventional answer is to install a&lt;br&gt;
clipboard manager: another app, another tray icon, another thing to learn.&lt;/p&gt;

&lt;p&gt;There is a different answer if you already use PowerToys. Its Command Palette&lt;br&gt;
is the keyboard launcher you open with Alt+Space. Type a few letters, pick a&lt;br&gt;
result, keep working. A free extension called NanoNotes puts two things in that&lt;br&gt;
launcher: a clipboard history that survives restarts, and a place for quick&lt;br&gt;
notes.&lt;/p&gt;

&lt;p&gt;So you get what a clipboard manager does, plus somewhere to put a thought, in a&lt;br&gt;
window you already open all day.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fls5gshpebdvhypjcazkm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fls5gshpebdvhypjcazkm.png" alt="NanoNotes: quick notes and clipboard history for the PowerToys Command Palette" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  What you need from it
&lt;/h3&gt;

&lt;p&gt;One place that opens from the keyboard. Type a thought, press Enter, it is&lt;br&gt;
saved. Later, search in one box and find both the thought and the thing you&lt;br&gt;
copied. Put either one back where you were working, without switching windows.&lt;/p&gt;

&lt;p&gt;Nothing in the cloud. No account to create. Nothing that needs to sync before&lt;br&gt;
it works.&lt;/p&gt;
&lt;h3&gt;
  
  
  NanoNotes
&lt;/h3&gt;

&lt;p&gt;It is a free extension for the PowerToys Command Palette. PowerToys is free&lt;br&gt;
software from Microsoft, and Command Palette is its launcher. NanoNotes adds&lt;br&gt;
notes and clipboard history to it.&lt;/p&gt;

&lt;p&gt;Here is the whole routine.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Press Alt+Space and type a thought. Press Enter. It is saved.&lt;/li&gt;
&lt;li&gt;Later, type a word you remember. One search shows your notes and the things
you copied, newest first, each row labelled so you know which is which.&lt;/li&gt;
&lt;li&gt;Press Enter on a row and it pastes back into the app you came from, whether
that is a form, a document, an email or a canvas.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmkyysf13kanvnvswyn6f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmkyysf13kanvnvswyn6f.png" alt="The notes list, newest first, with the full note on the right" width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It also keeps the images you copy, if you want it to. A screenshot from two days&lt;br&gt;
ago shows up in the same search.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F428qonzws147mo2k02rp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F428qonzws147mo2k02rp.png" alt="Clipboard history with text and image entries" width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The clipboard history survives restarts. That is the point of it.&lt;/p&gt;
&lt;h3&gt;
  
  
  Keyboard shortcuts
&lt;/h3&gt;

&lt;p&gt;Everything above starts from Alt+Space, but the clipboard has a shortcut of its&lt;br&gt;
own: Alt+V takes you straight to clipboard history. No mouse, no hunting for the&lt;br&gt;
command. Notes are just as quick: open the palette, type, press Enter.&lt;/p&gt;
&lt;h3&gt;
  
  
  Where it helps in an ordinary day
&lt;/h3&gt;

&lt;p&gt;You copy a delivery tracking number on your phone and need it on the PC later.&lt;br&gt;
It is still there.&lt;/p&gt;

&lt;p&gt;Someone reads out an address during a call. You open the palette, type it, press&lt;br&gt;
Enter, and keep listening.&lt;/p&gt;

&lt;p&gt;You copy a paragraph from an email, then lose it when a tab closes. Search a&lt;br&gt;
word from it and it comes back.&lt;/p&gt;

&lt;p&gt;You need an image you copied from a PDF yesterday. It sits in the same list as&lt;br&gt;
your text.&lt;/p&gt;

&lt;p&gt;You remember writing something about "deploy on Tuesday" but not where. One&lt;br&gt;
search finds the note, and you can paste it straight into the message you were&lt;br&gt;
writing.&lt;/p&gt;
&lt;h3&gt;
  
  
  Your data stays in a folder you can open
&lt;/h3&gt;

&lt;p&gt;This is the part that matters most.&lt;/p&gt;

&lt;p&gt;Notes and clipboard history are plain files in &lt;code&gt;Documents\Notes&lt;/code&gt;. Open them with&lt;br&gt;
Notepad. Copy them to a backup drive. Delete a file and the entry is gone. Read&lt;br&gt;
them five years from now even if the app no longer exists.&lt;/p&gt;

&lt;p&gt;There is no sign-in, no sync, no analytics and no network code in the extension.&lt;br&gt;
It works on a plane. It does not know your name.&lt;/p&gt;

&lt;p&gt;You choose how long clips are kept: 7 to 30 days, 14 by default, with a 500 entry&lt;br&gt;
limit. Image capture can be switched off.&lt;/p&gt;
&lt;h3&gt;
  
  
  Who this is not for
&lt;/h3&gt;

&lt;p&gt;If you want your notes on your phone and your PC, this is the wrong tool. There&lt;br&gt;
is no account and no sync, on purpose.&lt;/p&gt;

&lt;p&gt;If you want a different hotkey for every pinned snippet, a dedicated clipboard&lt;br&gt;
manager is still the better fit. Ditto and ClipClip are good at that. NanoNotes&lt;br&gt;
gives you one direct shortcut to clipboard history and Alt+Space for everything&lt;br&gt;
else.&lt;/p&gt;

&lt;p&gt;If you copy passwords out of a password manager, think before using any&lt;br&gt;
clipboard history, including this one. Whatever reaches the Windows clipboard&lt;br&gt;
can be recorded. Keep the retention short and clear the history if that bothers&lt;br&gt;
you.&lt;/p&gt;
&lt;h3&gt;
  
  
  Install it
&lt;/h3&gt;

&lt;p&gt;It is free in the Microsoft Store, so Windows handles the install and the&lt;br&gt;
updates.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;winget install NanoNotes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or install it from the &lt;a href="https://apps.microsoft.com/detail/9nw3g5pqwf51" rel="noopener noreferrer"&gt;Microsoft Store&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You need PowerToys with Command Palette enabled, on Windows 10 (19041 or newer)&lt;br&gt;
or Windows 11. Press Alt+Space, type &lt;code&gt;notes&lt;/code&gt;, and the extension's commands show&lt;br&gt;
up.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuyz9mo08v2x8z4kw6s6k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuyz9mo08v2x8z4kw6s6k.png" alt="NanoNotes commands in the PowerToys Command Palette" width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NanoNotes is open source under GPL-3, one person's project and not a Microsoft&lt;br&gt;
product. You can read every line of it.&lt;/p&gt;

&lt;p&gt;Feedback goes to the project's GitHub issues. The parts that get built next come&lt;br&gt;
from the people who use it.&lt;/p&gt;

</description>
      <category>windows</category>
      <category>opensource</category>
      <category>productivity</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>Google's new EGM is insane in OpenCode</title>
      <dc:creator>Azad Kshitij</dc:creator>
      <pubDate>Wed, 04 Nov 2026 08:15:48 +0000</pubDate>
      <link>https://dev.to/azadkshitij/googles-new-egm-is-insane-in-opencode-4dmk</link>
      <guid>https://dev.to/azadkshitij/googles-new-egm-is-insane-in-opencode-4dmk</guid>
      <description>&lt;p&gt;You ask your model to critique the design it just wrote, and it loves it. Of course it does. It has the whole conversation in context, it is anchored to its own reasoning, and "looks good to me" is the path of least resistance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy7ttm4o2z9r114x5zf2v.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy7ttm4o2z9r114x5zf2v.jpeg" alt="AI Image showing elephant and goldfish" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Elephant-Goldfish Model (EGM) fixes this with one idea: split the author from the reviewer. The elephant holds the big picture. The goldfish are fresh-context reviewers that never saw your discussion, your reasoning, or your best arguments. They see only the document, and they judge it on its own.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/google/elephant-goldfish-model" rel="noopener noreferrer"&gt;EGM&lt;/a&gt; is a design-review workflow open-sourced by Google, based on Dave Rensin's article &lt;a href="https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874" rel="noopener noreferrer"&gt;Elephants, Goldfish, and the New Golden Age of Software Engineering&lt;/a&gt;. It ships as a skill pack for a few other AI harnesses. I built &lt;strong&gt;opencode-egm&lt;/strong&gt;, an unofficial adapter that brings the whole thing to &lt;a href="https://opencode.ai" rel="noopener noreferrer"&gt;OpenCode&lt;/a&gt; V2 as a single plugin.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F617vrt02l7jxov9pp57h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F617vrt02l7jxov9pp57h.png" alt="Elephant-Goldfish Model header: elephant and goldfish facing each other" width="480" height="116"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;opencode plugin add opencode-egm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart OpenCode. To let the review orchestrator spawn its own reviewers, allow one level of nested subagents in &lt;code&gt;opencode.jsonc&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json-doc"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"experimental"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"subagent_depth"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without it, everything still runs; the primary agent does the spawning instead. On startup the plugin registers 7 skills, 10 personas, and 7 commands, self-contained in the package. No extra prompts or config files to copy around.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frkf37ca0wllc3z5wqv20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frkf37ca0wllc3z5wqv20.png" alt="Difference between the setting not having the setting" width="800" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What you get
&lt;/h2&gt;

&lt;p&gt;Seven slash commands cover the loop from rough idea to reviewed spec:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/egm-brainstorm &amp;lt;idea&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Turns a rough idea into a reviewed &lt;code&gt;concepts_brief.md&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/egm-draft [context]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Drafts &lt;code&gt;design_draft.md&lt;/code&gt; section by section, with approval gates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/egm-review &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Runs the fresh-context Goldfish review on a design doc&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/egm-review-loop &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Antagonistic review loop until the findings stop&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/egm-resolve &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Classifies each finding, applies the fixes you approve&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/egm-bootstrap &amp;lt;dir&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Writes README documentation contracts across a tree&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/egm-drift-report &amp;lt;dir&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Flags drift between your designs and the current code&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can start anywhere. &lt;code&gt;/egm-review&lt;/code&gt; works on a design you wrote yourself, hours ago, without involving the rest of the pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reviews from goldfish, not your model's inner voice
&lt;/h2&gt;

&lt;p&gt;This is the part I care about. Reviewers run as fresh child sessions with zero conversation history. Each one is a registered, read-only persona with a narrow job:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;egm-zoom-out&lt;/strong&gt; — skeptical architect. Simplicity, YAGNI, reuse what exists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;egm-design&lt;/strong&gt; — hostile design critic. Architecture, scalability, infrastructure economics, unmitigated risk.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;egm-comprehension&lt;/strong&gt; — naive reader. Flags undefined terms and assumed institutional knowledge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;egm-implementation-readiness&lt;/strong&gt; — pragmatic tech lead. Are the instructions actionable without further decisions?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;egm-codebase-details&lt;/strong&gt; — pedantic auditor. Does the doc match the actual codebase, and does it reuse what is already there?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;egm-structural&lt;/strong&gt; — layout validator. Heading hierarchy, symmetry, template compliance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;egm-style&lt;/strong&gt; — copy editor. Clarity, precision, no fluff.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An aggregator (&lt;strong&gt;egm-synthesizer&lt;/strong&gt;) deduplicates their findings and compiles the consolidated &lt;code&gt;goldfish_review_report.md&lt;/code&gt;. Reviewers cannot write files and cannot spawn subagents. The synthesizer can spawn reviewers itself and writes only the report. The permission model matches the job descriptions, so a reviewer that disagrees with your design can't "helpfully" rewrite it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gates that actually wait for you
&lt;/h2&gt;

&lt;p&gt;EGM workflows pause at decision points: which preset, which fixes, which scope. The original skills were written for harnesses that ended the turn and waited for a chat reply. opencode-egm reroutes every gate through OpenCode's &lt;code&gt;question&lt;/code&gt; tool instead. It blocks until you answer, then the workflow continues in the same turn. Pick an option, or type your own constraint into the free-form field. No dead ends in chat, no lost context between "questions".&lt;/p&gt;

&lt;p&gt;The artifacts are files, not wall-of-text chat replies: &lt;code&gt;concepts_brief.md&lt;/code&gt;, &lt;code&gt;design_draft.md&lt;/code&gt;, &lt;code&gt;goldfish_review_report.md&lt;/code&gt;, &lt;code&gt;YYYY-MM-DD_DRIFT_REPORT.md&lt;/code&gt;. Point &lt;code&gt;EGM artifact directory: docs/egm&lt;/code&gt; at a folder in your prompt or &lt;code&gt;AGENTS.md&lt;/code&gt; and everything lands there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Documentation that stays honest
&lt;/h2&gt;

&lt;p&gt;Two commands cover the part that rots fastest:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/egm-bootstrap src/&lt;/code&gt; walks a tree and writes README files that describe each directory's interface, invariants, and side effects — context for future agent runs, written by a parallel swarm of read-only scouts.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/egm-drift-report docs/designs&lt;/code&gt; compares your design docs against the code that exists now and reports where they disagree.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A typical session
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/egm-brainstorm Add an offline mode to the mobile app
/egm-draft concepts_brief.md
/egm-review design_draft.md feature_spec
/egm-resolve design_draft.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;/egm-review&lt;/code&gt; asks which pipeline preset you want (&lt;code&gt;feature_spec&lt;/code&gt;, &lt;code&gt;implementation&lt;/code&gt;, &lt;code&gt;uninterrupted&lt;/code&gt;, or a stage from 5 to 9) unless you name one. &lt;code&gt;/egm-resolve&lt;/code&gt; classifies every finding as fix-now, fix-later, or push-back, and applies only the fixes you approve.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unofficial.&lt;/strong&gt; This is an independent adapter, not a Google product and not something Google supports. The vendored skills and personas remain Copyright 2026 Google LLC, Apache-2.0.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fresh context, shared filesystem.&lt;/strong&gt; OpenCode child sessions start with no conversation history, but they share the working directory. A goldfish gets no parent reasoning; it can still read files you wrote. Other harnesses offer stronger isolation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reviews cost real tokens.&lt;/strong&gt; A full pass spawns several subagents and takes a few minutes. Use a capable model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not for everything.&lt;/strong&gt; EGM is for consequential, uncertain changes. A one-line bug fix doesn't need six reviewers. The FAQ is explicit that you own the outcomes — treat the findings as input to your judgment, not as verdicts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Plugin: &lt;a href="https://github.com/AzadKshitij/opencode-egm" rel="noopener noreferrer"&gt;github.com/AzadKshitij/opencode-egm&lt;/a&gt; — &lt;code&gt;opencode plugin add opencode-egm&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Upstream EGM: &lt;a href="https://github.com/google/elephant-goldfish-model" rel="noopener noreferrer"&gt;github.com/google/elephant-goldfish-model&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The idea: &lt;a href="https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874" rel="noopener noreferrer"&gt;Elephants, Goldfish, and the New Golden Age of Software Engineering&lt;/a&gt; by Dave Rensin&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stars, issues, and "this gate annoyed me" reports are all welcome. If you try it on a real design, I'd like to hear what the goldfish caught.&lt;/p&gt;

</description>
      <category>google</category>
      <category>ai</category>
      <category>opencode</category>
      <category>opensource</category>
    </item>
    <item>
      <title>How I built a realtime editor for ManimGL</title>
      <dc:creator>Azad Kshitij</dc:creator>
      <pubDate>Mon, 12 Oct 2026 18:48:33 +0000</pubDate>
      <link>https://dev.to/azadkshitij/how-i-built-a-realtime-editor-for-manimgl-1pj</link>
      <guid>https://dev.to/azadkshitij/how-i-built-a-realtime-editor-for-manimgl-1pj</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; With AI helping write the code, we built &lt;strong&gt;Manim Studio&lt;/strong&gt;, a realtime desktop editor for &lt;a href="https://github.com/3b1b/manim" rel="noopener noreferrer"&gt;ManimGL&lt;/a&gt; scenes: code on the left, a &lt;em&gt;live&lt;/em&gt; preview on the right, a scrubbable timeline below. No render-wait-tweak loop: save the file and the preview updates in place; retime an animation by dragging it. It went from an empty project to &lt;strong&gt;v1.1.0 in 124 commits&lt;/strong&gt;. This is Part 1: why it exists, what it does, and how it went. Part 2 is the technical deep-dive into the architecture and every choice that shaped it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The itch
&lt;/h2&gt;

&lt;p&gt;Manim makes beautiful math animations, and I make them for my YouTube channel. The trouble is the &lt;em&gt;making&lt;/em&gt;. My loop was always the same: write a scene, wait for the render, watch the result, tweak one number, wait again. It was slow, and nothing about it felt like editing.&lt;/p&gt;

&lt;p&gt;I tried the tools that already existed. The &lt;a href="https://www.manim.community/" rel="noopener noreferrer"&gt;Manim Community&lt;/a&gt; version. VS Code extensions driving Jupyter notebooks. Neither stuck. The iteration speed was the killer, and Jupyter never felt like an editor. It's a place to run code and inspect output, not a place to work on an animation.&lt;/p&gt;

&lt;p&gt;So I stopped looking and started building: something &lt;strong&gt;faster&lt;/strong&gt;, that &lt;strong&gt;feels like a video editor&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That single sentence turned out to be a design brief for everything that followed. "Faster" meant never rendering a video just to see a change. "Feels like a video editor" meant a timeline you scrub, a playhead, and retiming an animation by dragging its edge instead of editing a &lt;code&gt;run_time=&lt;/code&gt; literal and re-rendering.&lt;/p&gt;

&lt;p&gt;I didn't write all the code by hand. I used AI to help write it. When I say "we" in this post, I mean me and the AI working on the implementation. "I" still means my own experience, goals, and decisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  The premise
&lt;/h2&gt;

&lt;p&gt;Before writing code I wrote down what I actually wanted, and gave myself three non-negotiables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Realtime preview.&lt;/strong&gt; A persistent OpenGL context, updated at 30 fps, with no ffmpeg encode per edit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Production-grade, no hacks.&lt;/strong&gt; Fully tested. Whenever a design decision changed course, I wrote down why. That habit became an &lt;a href="https://github.com/AzadKshitij/manim-studio/blob/main/AGENTS.md" rel="noopener noreferrer"&gt;&lt;code&gt;AGENTS.md&lt;/code&gt;&lt;/a&gt; contract and nine architecture decision records.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Drivable by an agent.&lt;/strong&gt; I wanted to be able to say "build me a CircleToSquare scene" and have a CLI do it. Everything in the GUI is also a command.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The shape of the app is almost boringly simple: a code editor on the left, the running scene on the right, the timeline below. Everything else exists to keep those three in sync.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc36uzh5cakkir8b3rdz1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc36uzh5cakkir8b3rdz1.png" alt="ManimStudio" width="800" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The editor: code on the left, live preview on the right, timeline below.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What it actually does
&lt;/h2&gt;

&lt;p&gt;Concretely, this is what's in the box:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A real code editor.&lt;/strong&gt; Scintilla, not a textbox: &lt;code&gt;manimlib&lt;/code&gt; autocomplete and call signatures, error markers that jump to the failing line, syntax highlighting, full undo/redo.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A live preview&lt;/strong&gt;, embedded in the window by default or shown in a separate GL window, plus a live IPython shell wired to the running scene.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A timeline built from a runtime trace&lt;/strong&gt; of &lt;code&gt;play()&lt;/code&gt; and &lt;code&gt;wait()&lt;/code&gt;, so loops and branches produce the right blocks. Drag to scrub the live scene, wheel to pan, &lt;code&gt;Ctrl&lt;/code&gt;+wheel to zoom, arrow keys to step one frame.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An editable timeline.&lt;/strong&gt; Retime or delete an animation by dragging it or typing an exact duration. The edit is anchored to the &lt;em&gt;code&lt;/em&gt;, saved next to your scene, and baked into the export.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One-click export&lt;/strong&gt; to MP4 (up to 4K/60), GIF, or a still, using headless &lt;code&gt;manimgl -w&lt;/code&gt; and honouring your timeline edits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A CLI for everything.&lt;/strong&gt; Every feature is also a command, so the editor can be driven by an agent.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last point mattered more than I expected. Because the GUI only ever talks to the preview host through a message protocol, the exact same commands are available from a terminal: &lt;code&gt;check&lt;/code&gt;, &lt;code&gt;trace&lt;/code&gt;, &lt;code&gt;export&lt;/code&gt;, &lt;code&gt;new&lt;/code&gt;, and &lt;code&gt;preview&lt;/code&gt;. I can say "build me a CircleToSquare scene" and the tooling can actually do it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The trajectory
&lt;/h2&gt;

&lt;p&gt;Three shippable states, each with a job to do:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Release&lt;/th&gt;
&lt;th&gt;What landed&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;0.1.0: initial shareable build&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Scintilla editor, embedded realtime preview, runtime-traced timeline with replay-based scrubbing and a filmstrip cache, live IPython shell, video/still export, and the headless CLI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;1.0.0: first public release&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Pygments syntax highlighting, Jedi autocomplete + calltips, app icon, live memory/RAM status, and a one-click &lt;strong&gt;frozen Windows build&lt;/strong&gt; (portable zip + per-user installer)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;1.1.0&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The &lt;strong&gt;editable timeline&lt;/strong&gt;: retime and delete animations as anchored edits stored beside the scene, baked into exports. Themes. A big rendering-performance pass&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;0.1.0 is &lt;em&gt;"it works."&lt;/em&gt; 1.0.0 is &lt;em&gt;"someone else can install it."&lt;/em&gt; 1.1.0 is where it stops being a preview and becomes an &lt;strong&gt;editor&lt;/strong&gt;: you don't just watch the timeline, you work on it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft3yten3m2kbbcep7od3r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft3yten3m2kbbcep7od3r.png" alt="Timeline Editor" width="798" height="109"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Lanes per animation, a block inspector, scrub, and the orphan tray.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How it actually went
&lt;/h2&gt;

&lt;p&gt;A few habits kept the project honest as it grew. Every decision that bent the design got written down as an ADR the moment I made it: nine of them, in order, from "why a separate process" to "how to reuse cached frames after an edit." We kept the test suite green before every commit (by the first release: &lt;strong&gt;474 passing tests&lt;/strong&gt;), and we optimised nothing without a benchmark to prove the change.&lt;/p&gt;

&lt;p&gt;It wasn't smooth, though. Scrubbing took &lt;strong&gt;three designs&lt;/strong&gt; to get right, and the obvious one didn't work.&lt;/p&gt;

&lt;p&gt;The written decisions are what stopped me re-litigating the same question three times, and the tests are what let us refactor a 1,000-line file into eight without breaking it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Becoming Manim Studio
&lt;/h2&gt;

&lt;p&gt;The product began as "Manim Editor" and was renamed Manim Studio on the way to the first public release: import package &lt;code&gt;manim_studio&lt;/code&gt;, CLI &lt;code&gt;manim-studio&lt;/code&gt;, Windows bundle &lt;code&gt;ManimStudio&lt;/code&gt;. "Studio" describes what it grew into: not a text editor that also shows you a preview, but an environment you work in. The same stretch of work made the repository real: an MIT license, a CI pipeline (format, lint, types, and tests, currently on Windows), a tagged release workflow, Dependabot, and the usual community files. "It works on my machine" became "it works on yours."&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;Manim Studio is MIT-licensed and open source. The packaged build is for &lt;strong&gt;Windows&lt;/strong&gt; (a portable zip or a per-user installer); CI currently runs on Windows too. Grab it from the &lt;a href="https://github.com/AzadKshitij/manim-studio/releases" rel="noopener noreferrer"&gt;Releases page&lt;/a&gt;, or clone the repo from &lt;a href="https://github.com/AzadKshitij/manim-studio" rel="noopener noreferrer"&gt;github.com/AzadKshitij/manim-studio&lt;/a&gt;. If you make Manim animations, I'd love to hear what's missing. Issues, feedback, and stars are all welcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Part 2 covers
&lt;/h2&gt;

&lt;p&gt;Part 1 was the story. Part 2 is the engineering, and it's where the interesting decisions live:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why the preview runs in a &lt;strong&gt;separate process&lt;/strong&gt; that owns the only OpenGL context, and why the editor's GUI never touches GL.&lt;/li&gt;
&lt;li&gt;Why the timeline is a &lt;strong&gt;runtime trace&lt;/strong&gt;, not a parsed AST.&lt;/li&gt;
&lt;li&gt;Scrubbing, &lt;strong&gt;three designs deep&lt;/strong&gt;, and why the obvious one doesn't work.&lt;/li&gt;
&lt;li&gt;How "make it fast" became a &lt;strong&gt;measured discipline&lt;/strong&gt; with before/after numbers.&lt;/li&gt;
&lt;li&gt;How the timeline became an editor through &lt;strong&gt;anchored patches in a sidecar file&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The long tail: LaTeX on demand, frozen packaging, themes-as-data, and the gotchas that cost real hours.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>manim</category>
      <category>opensource</category>
      <category>productivity</category>
      <category>python</category>
    </item>
    <item>
      <title>Organize Your Godot Exports with export_category in Godot 4</title>
      <dc:creator>Azad Kshitij</dc:creator>
      <pubDate>Thu, 28 Sep 2023 13:00:00 +0000</pubDate>
      <link>https://dev.to/azadkshitij/organize-your-godot-exports-with-exportcategory-in-godot-4-3903</link>
      <guid>https://dev.to/azadkshitij/organize-your-godot-exports-with-exportcategory-in-godot-4-3903</guid>
      <description>&lt;p&gt;Have you ever wondered how to neatly categorize your exported variables in Godot? The answer lies in the &lt;code&gt;export_category&lt;/code&gt; keyword, a fantastic new feature introduced in Godot 4. It allows you to group your exported variables, maintaining organization and tidiness in your scripts.&lt;/p&gt;

&lt;h2&gt;
  
  
  YouTube
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/_L2rIhp7Vso" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Use export_category:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's remarkably simple. Just place &lt;code&gt;@export_category("YourCategoryName")&lt;/code&gt; before the &lt;code&gt;@export&lt;/code&gt; keyword. For instance, if you're working on a player script and want to create a category called "Movement," it's as easy as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="n"&gt;export_category&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Movement"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;jump_height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this, you'll have a "Movement" category neatly displayed in your inspector, containing all related exported variables. To add more categories, simply place &lt;code&gt;@export_category&lt;/code&gt; above your desired exported variables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gdscript"&gt;&lt;code&gt;&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="n"&gt;export_category&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Player Info"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Bit Of Code"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why Use export_category:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep your projects organized, even with numerous exported variables.&lt;/li&gt;
&lt;li&gt;Enhance script readability and maintainability.&lt;/li&gt;
&lt;li&gt;Simplify tweaking and fine-tuning during development.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I hope you found this tutorial helpful and discovered a new way to organize your Godot projects. If you did, please give it a like and if you prefer a video version watch the short to better understand &lt;code&gt;export_category&lt;/code&gt;&lt;/p&gt;

</description>
      <category>godot</category>
      <category>gamedev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Lookup in 1 min</title>
      <dc:creator>Azad Kshitij</dc:creator>
      <pubDate>Tue, 11 Jul 2023 16:57:38 +0000</pubDate>
      <link>https://dev.to/azadkshitij/lookup-in-1-min-582h</link>
      <guid>https://dev.to/azadkshitij/lookup-in-1-min-582h</guid>
      <description>&lt;p&gt;This is a handy function when you need to look up something quickly and easily.&lt;/p&gt;

&lt;p&gt;LOOKUP has two forms: vector and array. The vector form is simpler and more common, so I'll focus on that one. The vector form of LOOKUP has three arguments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;lookup_value: This is the value that you want to find in a row or column. It can be a number, text, a logical value, or a reference to a cell.&lt;/li&gt;
&lt;li&gt;lookup_vector: This is the range that contains the values that you want to match with lookup_value. It can be a row or a column, but it must be sorted in ascending order.&lt;/li&gt;
&lt;li&gt;result_vector: This is the range that contains the values that you want to return from the same position as lookup_value. It can be a row or a column, but it must be the same size as lookup_vector.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, let's say you have a table of products and prices like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Product&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Apple&lt;/td&gt;
&lt;td&gt;$1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Banana&lt;/td&gt;
&lt;td&gt;$2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cherry&lt;/td&gt;
&lt;td&gt;$3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Date&lt;/td&gt;
&lt;td&gt;$4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Eggplant&lt;/td&gt;
&lt;td&gt;$5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you want to find the price of a product, you can use LOOKUP like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;=LOOKUP("Cherry",A2:A6,B2:B6)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This formula will return $3, because "Cherry" is in cell A4, and $3 is in cell B4.&lt;/p&gt;

&lt;p&gt;You can also use LOOKUP to find the product name for a given price, like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;=LOOKUP(4,A2:B6,A2:A6)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This formula will return "Date", because 4 is in cell B5, and "Date" is in cell A5.&lt;/p&gt;

&lt;p&gt;That's it for this blog post. I hope you learned something new about LOOKUP in Excel. If you have any questions or comments, feel free to leave them below. Thanks for reading!&lt;/p&gt;

</description>
      <category>excel</category>
      <category>datascience</category>
      <category>dataengineering</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Data Science: %%timeit in python</title>
      <dc:creator>Azad Kshitij</dc:creator>
      <pubDate>Thu, 26 Jan 2023 06:30:00 +0000</pubDate>
      <link>https://dev.to/azadkshitij/data-science-what-is-timeit-in-python-26c4</link>
      <guid>https://dev.to/azadkshitij/data-science-what-is-timeit-in-python-26c4</guid>
      <description>&lt;h2&gt;
  
  
  Youtube Short
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/DCSzxDiteIc" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In Python, the &lt;code&gt;%%timeit&lt;/code&gt; magic command is a handy tool for measuring the execution time of small bits of code. It can be used in interactive environments like Jupyter notebooks.&lt;/p&gt;

&lt;p&gt;To use &lt;code&gt;%%timeit&lt;/code&gt;, you simply place it at the beginning of a cell in a Jupyter notebook, followed by the code you want to measure the execution time of. &lt;code&gt;%%timeit&lt;/code&gt; will then run the code multiple times and return the fastest run time among all the runs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frybkkmpu6bwn0et2wjy0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frybkkmpu6bwn0et2wjy0.png" alt="timeit code" width="799" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The output shows the time it took to run the code in microseconds, as well as the mean and standard deviation of the run times across multiple runs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flq5hbjxe7vtl3x41ady5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flq5hbjxe7vtl3x41ady5.png" alt="cell output" width="798" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The number of runs and loops can be adjusted by passing arguments to &lt;code&gt;%%timeit&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdtbs9lc6wf69voyill6u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdtbs9lc6wf69voyill6u.png" alt="timeit with arguments" width="800" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, &lt;code&gt;%%timeit&lt;/code&gt; will run the code 10 times and do 100 loops per run.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fml53q9xuwd3oz2wtvteg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fml53q9xuwd3oz2wtvteg.png" alt="Argument Result" width="799" height="159"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;%%timeit&lt;/code&gt; is a useful tool for identifying performance bottlenecks in your code and optimizing the most heavily used sections. It can be especially helpful for comparing the performance of different algorithms or implementations.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>gratitude</category>
      <category>writing</category>
    </item>
    <item>
      <title>Data Science: What is a box plot?</title>
      <dc:creator>Azad Kshitij</dc:creator>
      <pubDate>Thu, 05 Jan 2023 09:30:00 +0000</pubDate>
      <link>https://dev.to/azadkshitij/data-science-what-is-a-box-plot-335h</link>
      <guid>https://dev.to/azadkshitij/data-science-what-is-a-box-plot-335h</guid>
      <description>&lt;h2&gt;
  
  
  Youtube Short
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/XDEgB7kPMWw" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;A box plot, also known as a box and whisker plot, is a graphical representation of a dataset that shows the distribution of values in the data. It is a useful tool for visualizing the spread and skewness of a dataset, as well as identifying outliers.&lt;/p&gt;

&lt;p&gt;The box plot can be used to compare the distribution of multiple datasets by creating a box plot for each dataset and placing them side by side. It is also possible to overlay box plots on top of each other to compare the distributions more closely.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fctnj9q7lvlcdct2h0bno.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fctnj9q7lvlcdct2h0bno.png" alt="Box plot image" width="800" height="725"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Box plot is a graphical representation of a dataset that shows the distribution of values in the data. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The top line is maximum value.&lt;/li&gt;
&lt;li&gt;Bottom line is minimum value.&lt;/li&gt;
&lt;li&gt;The Centre line is Median. &lt;/li&gt;
&lt;li&gt;Top of the box is 75th percentile value.&lt;/li&gt;
&lt;li&gt;Bottom of the box is 25th percentile value.&lt;/li&gt;
&lt;li&gt;You see those circles outside yes those are called 'outliers'.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Lets see how to create one with python.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start by importing necessary packages.&lt;/li&gt;
&lt;li&gt;We will use seaborn to create the plot.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;seaborn&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;sns&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Lets use some inbuilt dataset that comes with seaborn. called taxis. and set the style of the graph as white grid.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;whitegrid&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load_dataset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;taxis&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now define values for the x-axis and y-axis. and define a list of cities you want to create box plot for.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pickup_borough&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;total&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;cities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Queens&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create the plot with &lt;code&gt;sns.boxplot()&lt;/code&gt; function, and provide &lt;code&gt;df&lt;/code&gt;  as data. set x as x y as y and order boxplot in order of cities list. Now use &lt;code&gt;plt.show()&lt;/code&gt; function to show the graph.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;ax&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;boxplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cities&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Final
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;seaborn&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;sns&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;

&lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;whitegrid&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load_dataset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;taxis&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pickup_borough&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;total&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;cities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Queens&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;ax&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;boxplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;cities&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdvb8a64d3dbptl5wwsc8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdvb8a64d3dbptl5wwsc8.png" alt="Bol plot created with python image" width="758" height="1212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope this tutorial has helped you understand the basics of box plots. If you have any questions comment them down below I will be more than happy to answer them.&lt;/p&gt;

</description>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Data Science: 10 Ways to improve your pandas code</title>
      <dc:creator>Azad Kshitij</dc:creator>
      <pubDate>Wed, 21 Dec 2022 11:30:00 +0000</pubDate>
      <link>https://dev.to/azadkshitij/data-science-10-ways-to-improve-your-pandas-code-1i11</link>
      <guid>https://dev.to/azadkshitij/data-science-10-ways-to-improve-your-pandas-code-1i11</guid>
      <description>&lt;p&gt;In this post we will talk about writing better pandas code just by some simple set of rules and using inbuild function provided by pandas. Your code might be working before but these changes will make your code more readable and more manageable and some time run faster. Don't let the reader know that you are new.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Writing into csv with unnecessary index.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you save a DataFrame to a csv format, by default it will be saves with a index column. This will unnecessarily increase the size of our csv file. We can change this behaviour by doing &lt;code&gt;index = False&lt;/code&gt; in the &lt;code&gt;to_csv()&lt;/code&gt; function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output_index.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Using column names which include spaces.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is some time okay if you are sending the file to some one non technical but for actual work it sometime creates many problem. use &lt;code&gt;_&lt;/code&gt; instead of spaces, after doing this it will be easy to access them by &lt;code&gt;.&lt;/code&gt; notation in pandas.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt; 
&lt;span class="c1"&gt;# Output: Index(['Series_reference', 'Period', 'Data_value', 'Suppressed', 'STATUS', 'UNITS', 'MAGNTUDE', 'Subject', 'Group', 'Series_title_1'], dtype='object')
&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Series_reference&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Filter dataset like a PRO with QUERY method&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use &lt;code&gt;.query()&lt;/code&gt; function provide by pandas instead of using manual conditions. &lt;br&gt;
ex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# This
&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Period&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;1971&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Period&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="mi"&gt;1973&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;# Can be simplified as this...
&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; 1971 &amp;lt;= Period &amp;lt;= 1973 &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;query strings with(@ symbol) to easily reach variables &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This might be bit controversial as some people like have references of their variables and to make it more readable, but just to inform you about this feature that you can use &lt;code&gt;@&lt;/code&gt; to reference variable in a query string. like this...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;min_year&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1971&lt;/span&gt;
&lt;span class="n"&gt;max_year&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1973&lt;/span&gt;
&lt;span class="c1"&gt;# This:
&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;min_year&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; &amp;lt;= Period &amp;lt;= &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;max_year&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Can be simplified as this...
&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; @min_year &amp;lt;= Period &amp;lt;= @max_year &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;"inplace" method could be removed in future versions, better explicitly overwrite modifications &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;inplace&lt;/code&gt; method could be removed in future versions so better explicitly modify the DataFrame by reassigning.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# This 
&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fillna&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inplace&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Should be changed to this... 
&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fillna&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Better Vectorization instead of iteration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As I mentioned about the performance of you function the loops are no top of that discussion. You can iterate over each row of you DataFrame but that is not a good idea if you just want to create a new column by applying conditions on you DataFrame.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;%%&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;iterrows&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
&lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Period&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;is_recent&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
&lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;is_recent&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_recent&lt;/span&gt;
&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
CPU times: total: 34.3 s 
Wall time: 37.9 s
&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But by using Vectorization we can significantly reduce the time&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;%%&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;is_not_recent&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Period&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;2000&lt;/span&gt;
&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
CPU times: total: 15.6 ms 
Wall time: 993 µs
&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Vectorization method are preferable than Apply &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The apply method does take less time then iteration it is still not as good as the vectorization.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;%%&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;recent&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Period&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;axis&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;recent&lt;/span&gt;
&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
CPU times: total: 2.59 s 
Wall time: 2.92 s
&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;df.copy() method&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to use a single column as a new DataFrame then you shoud use &lt;code&gt;.copy()&lt;/code&gt; otherwise if you change the newly created dataframe it will also change the same in original dataframe.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;new_df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Chaining formulas is better than creating many intermediate dataframes &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Chaining operations will be a lot more useful than you think just look at this example...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# This 
&lt;/span&gt;&lt;span class="n"&gt;df1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Period &amp;gt; 2000&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;groupby&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;STATUS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])[[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Period&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]].&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;df_out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort_values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Period&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Can be simplified as this...
&lt;/span&gt;&lt;span class="n"&gt;df_out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Period &amp;gt; 2000&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;groupby&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;STATUS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])[[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Period&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]].&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="err"&gt;&amp;nbsp;&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort_values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Period&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="n"&gt;df_out&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, you decide by your self which one you want to use.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Properly set column dtypes &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When it comes to memory pandas can be a 'memory hog' but there are ways to keep the memory usage low. You can try changing &lt;code&gt;dtypes&lt;/code&gt; of a column. Sometime you have a column that stores 'Y' for True and 'N' for 'False' you can change the type of that column which will speedup the operations on that column as well as reduce the size of DataFrame. Try applying these conversions...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;
&lt;span class="n"&gt;float63&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Smaller&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt; &lt;span class="n"&gt;values&lt;/span&gt; &lt;span class="n"&gt;like&lt;/span&gt; &lt;span class="n"&gt;float32&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;float16&lt;/span&gt;
&lt;span class="n"&gt;int64&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;smaller&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="n"&gt;values&lt;/span&gt; &lt;span class="n"&gt;like&lt;/span&gt; &lt;span class="n"&gt;int32&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;int16&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are the 10 ways in which you can improve your pandas code, in future article we will talk about more ways to improve your datascience projects. If you have anything to say comment down below I'm new to blog writing so any type of feedback is appreciated Thanks.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=_gaAoJBMJ_Q" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=_gaAoJBMJ_Q&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>datascience</category>
      <category>pandas</category>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Machine Learning: Basic Terms</title>
      <dc:creator>Azad Kshitij</dc:creator>
      <pubDate>Fri, 16 Dec 2022 06:30:00 +0000</pubDate>
      <link>https://dev.to/azadkshitij/machine-learning-basic-terms-13pk</link>
      <guid>https://dev.to/azadkshitij/machine-learning-basic-terms-13pk</guid>
      <description>&lt;p&gt;In these series of articles we will talk about ML algorithms and implement them in python and the main focus of these articles is to understand math and logic behind these algorithms. We will start by understanding basic terms of ML. &lt;/p&gt;

&lt;h4&gt;
  
  
  1. Classification Algorithms
&lt;/h4&gt;

&lt;p&gt;As the name suggest these are classification algorithms that &lt;strong&gt;categorizes the data into different category&lt;/strong&gt;. It is a Supervised Learning technique.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Supervised Learning
&lt;/h4&gt;

&lt;p&gt;Supervised learning is associated with &lt;strong&gt;learning with supervision or training&lt;/strong&gt;. In supervised learning, the algorithms are trained with data which is labeled or classified.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Unsupervised learning
&lt;/h4&gt;

&lt;p&gt;Unsupervised learning is associated with &lt;strong&gt;learning without supervision&lt;/strong&gt; or training. In unsupervised learning, the algorithms are trained with data which is neither labeled nor classified. In unsupervised learning, the agent needs to learn from patterns without corresponding output values. &lt;/p&gt;

&lt;h4&gt;
  
  
  4. Cross-Entropy Loss
&lt;/h4&gt;

&lt;p&gt;Is&amp;nbsp;&lt;strong&gt;a metric used to measure how well a classification model in machine learning performs&lt;/strong&gt;. The loss (or error) is measured as a number between 0 and 1, with 0 being a perfect model.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. Condition positive (P)
&lt;/h4&gt;

&lt;p&gt;The number of real positive cases in the data&lt;/p&gt;

&lt;h4&gt;
  
  
  6. Condition negative (N)
&lt;/h4&gt;

&lt;p&gt;The number of real negative cases in the data&lt;/p&gt;

&lt;h4&gt;
  
  
  7. True positive (TP)
&lt;/h4&gt;

&lt;p&gt;A test result that correctly indicates the presence of a condition or characteristic&lt;/p&gt;

&lt;h4&gt;
  
  
  8. True negative (TN)
&lt;/h4&gt;

&lt;p&gt;A test result that correctly indicates the absence of a condition or characteristic&lt;/p&gt;

&lt;h4&gt;
  
  
  9. False positive (FP)
&lt;/h4&gt;

&lt;p&gt;A test result which wrongly indicates that a particular condition or attribute is present&lt;/p&gt;

&lt;h4&gt;
  
  
  10. False negative (FN)
&lt;/h4&gt;

&lt;p&gt;A test result which wrongly indicates that a particular condition or attribute is absent&lt;/p&gt;

&lt;h4&gt;
  
  
  11. Confusion Matrix
&lt;/h4&gt;

&lt;p&gt;It provides us the result of our model in matrix form (as shown below). We use this to measure accuracy of the mode.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Actual positive&lt;/th&gt;
&lt;th&gt;Actual Negative&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Predicted Positive&lt;/td&gt;
&lt;td&gt;True Positive&lt;/td&gt;
&lt;td&gt;False Negative&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Predicted Negative&lt;/td&gt;
&lt;td&gt;False Negative&lt;/td&gt;
&lt;td&gt;True Negative&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h4&gt;
  
  
  12. Area Under the Curve (AUC)
&lt;/h4&gt;

&lt;p&gt;Is the area encapsulated between the curve and x-axis. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhv984hiimtz4rx2eclpn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhv984hiimtz4rx2eclpn.png" alt="Area Under the Curve" width="627" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  13. Receiver Operating Characteristic (ROC)
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;The receiver operating characteristic (ROC) curve, which is defined as a plot of test sensitivity as the y coordinate versus its 1-specificity or false positive rate (FPR) as the x coordinate &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;

&lt;/p&gt;
&lt;div class="katex-element"&gt;
  &lt;span class="katex-display"&gt;&lt;span class="katex"&gt;&lt;span class="katex-mathml"&gt;&lt;/span&gt;&lt;span class="katex-html"&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;ROC&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mrel"&gt;=&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord"&gt;&lt;span class="mopen nulldelimiter"&gt;&lt;/span&gt;&lt;span class="mfrac"&gt;&lt;span class="vlist-t vlist-t2"&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="mord"&gt;&lt;span class="mord mathnormal"&gt;hi&lt;/span&gt;&lt;span class="mord mathnormal"&gt;t&lt;/span&gt;&lt;span class="mord mathnormal"&gt;s&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mbin"&gt;+&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;mi&lt;/span&gt;&lt;span class="mord mathnormal"&gt;sses&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="frac-line"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="mord"&gt;&lt;span class="mord mathnormal"&gt;hi&lt;/span&gt;&lt;span class="mord mathnormal"&gt;t&lt;/span&gt;&lt;span class="mord mathnormal"&gt;s&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="vlist-s"&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="mclose nulldelimiter"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft0p1tkbse551b9r6c6xg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft0p1tkbse551b9r6c6xg.png" alt="Receiver Operating Characteristic" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This image from Wikipedia shows exact definition of ROC.&lt;/p&gt;

&lt;p&gt;If you want me to include any other terms in this article comment them and I will do my best to include them. &lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.javatpoint.com/classification-algorithm-in-machine-learning" rel="noopener noreferrer"&gt;https://www.javatpoint.com/classification-algorithm-in-machine-learning&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Park SH, Goo JM, Jo CH. Receiver operating characteristic (ROC) curve: practical review for radiologists. Korean J Radiol. 2004 Jan-Mar;5(1):11-8. doi: 10.3348/kjr.2004.5.1.11. PMID: 15064554; PMCID: PMC2698108.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/Receiver_operating_characteristic" rel="noopener noreferrer"&gt;https://en.wikipedia.org/wiki/Receiver_operating_characteristic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.google.com/machine-learning/crash-course/classification/roc-and-auc" rel="noopener noreferrer"&gt;https://developers.google.com/machine-learning/crash-course/classification/roc-and-auc&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Data Science: Saving Pandas Dataframe the Efficient Way</title>
      <dc:creator>Azad Kshitij</dc:creator>
      <pubDate>Sun, 04 Dec 2022 11:30:00 +0000</pubDate>
      <link>https://dev.to/azadkshitij/data-science-edfficient-way-of-saving-pandas-dataframe-5422</link>
      <guid>https://dev.to/azadkshitij/data-science-edfficient-way-of-saving-pandas-dataframe-5422</guid>
      <description>&lt;p&gt;So you are done processing your data, now what? You might want to send the processed data to someone else or save the result for later. In such case you you will use pandas method &lt;code&gt;to_format(file_name)&lt;/code&gt;. let say you want to save to &lt;code&gt;.csv&lt;/code&gt; you will write &lt;code&gt;.to_csv("csv.csv")&lt;/code&gt;. The most common way is to save it as &lt;strong&gt;.csv&lt;/strong&gt; form because is the most &lt;strong&gt;versatile&lt;/strong&gt; and anyone can open and understand the content of file. &lt;/p&gt;

&lt;p&gt;But But But saving it to .csv is not the best way to save a &lt;strong&gt;DataFrame&lt;/strong&gt;, as there are many flaws of saving it to a .csv file. Let say our original dataframe had some columns with &lt;strong&gt;object&lt;/strong&gt; as a datatype and durign the processing we converted it into a category datatype now if we save the dataframe to a &lt;code&gt;.csv&lt;/code&gt;, it &lt;strong&gt;will loos the changed datatype&lt;/strong&gt; and we have to start all over again. Now what is the solution?&lt;/p&gt;

&lt;p&gt;Pandas support saving to many other file formats such as &lt;strong&gt;parquet&lt;/strong&gt;, &lt;strong&gt;feather&lt;/strong&gt;, &lt;strong&gt;pkl&lt;/strong&gt;, &lt;strong&gt;hd5&lt;/strong&gt; etc. All these formats saves the information about the datatype. Lets do some comparison between all these formats. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I used &lt;a href="https://stats.govt.nz/assets/Uploads/Balance-of-payments/BoPIIP-June-2022-quarter/Download-data/balance-of-payments-and-international-investment-position-june-2022-quarter-csv.csv" rel="noopener noreferrer"&gt;this&lt;/a&gt; dataset to perform the benchmarking.&lt;/li&gt;
&lt;li&gt;I read the CSV file and saved them into different files.&lt;/li&gt;
&lt;li&gt;Used seaborn to plot the graphs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Write Speed
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fex88nc3zhoq8xa7epzay.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fex88nc3zhoq8xa7epzay.png" alt="Write Speed" width="558" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the above graph we can see that saving to csv takes the most time and all other formats takes significantly less time to save. Feather is the clear winner followed by h5 and pkl then parquet. &lt;/p&gt;

&lt;h2&gt;
  
  
  Read Time
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1x6ycn489pe95og74xrp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1x6ycn489pe95og74xrp.png" alt="Read Time" width="570" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the above graph we can see that reading a csv takes the most time and all other formats takes significantly less time to read. PKL is the clear winner followed by feather and h5 then parquet.&lt;/p&gt;

&lt;h2&gt;
  
  
  File Size
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbnjb36crv50ofrqu14y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbnjb36crv50ofrqu14y.png" alt="File Size" width="594" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now this is something interesting as you can see parquet is the clear winner and the runner up feather  takes almost 3 times more than that. &lt;/p&gt;

&lt;p&gt;From the above results you can decide by yourself which format you want to use. You might stick to csv if you are working with non technical people, but if you are working in tech and collaborating you might find parquet the perfect fit for sharing online because of its low file size.&lt;/p&gt;

&lt;p&gt;If you have anything to say comment down below I'm new to blog writing so any type of feedback is appreciated Thanks.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Data Science: Linear Algebra with Python</title>
      <dc:creator>Azad Kshitij</dc:creator>
      <pubDate>Fri, 11 Nov 2022 11:30:00 +0000</pubDate>
      <link>https://dev.to/azadkshitij/datascience-linear-algebra-with-python-529</link>
      <guid>https://dev.to/azadkshitij/datascience-linear-algebra-with-python-529</guid>
      <description>&lt;h2&gt;
  
  
  Linear Algebra
&lt;/h2&gt;

&lt;p&gt;Linear algebra is the branch of mathematics that deals with vector spaces. It contains concept of vector, matrix etc. Linear algebra is widely used by data scientists (frequently implicitly, and not infrequently by people who don’t understand it). It wouldn’t be a bad idea to read a textbook.&lt;/p&gt;

&lt;h3&gt;
  
  
  Vector
&lt;/h3&gt;

&lt;p&gt;Vectors, in general, are objects that can be added together (to form new vectors) and that can be multiplied by scalars (numbers) to create new vectors Vectors are concretely (for us) points in some finite-dimensional space. Although you may not think of your data as vectors, they are a good way to represent numerical data. For instance, if you have a large number of people's heights, weights, and ages, You can think of your data as three-dimensional vectors (height, weight, age). If If you're teaching a class with four exams, you can treat student grades as four-point scale. vectors with dimensions (exam1, exam2, exam3, exam4). The most basic method is to represent vectors as lists of numbers. A list of three numbers corresponds to a vector in three-dimensional space, and vice versa:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;weight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# kg
&lt;/span&gt;          &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# kg
&lt;/span&gt;          &lt;span class="mi"&gt;30&lt;/span&gt;  &lt;span class="c1"&gt;# Kg
&lt;/span&gt;      &lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# meter
&lt;/span&gt;          &lt;span class="mi"&gt;25&lt;/span&gt;  &lt;span class="c1"&gt;# Meter
&lt;/span&gt;    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;One issue with this approach is that we will want to perform arithmetic on vectors. Because Python lists aren't vectors (and thus don't support vector operations), arithmetic), we'll have to create our own arithmetic tools. So let's start there. To begin, we'll frequently need to combine two vectors. Vectors are added component by component. This means that if two vectors v and w have the same length, their sum is the vector itself. whose first element is 

&lt;span class="katex-element"&gt;
  &lt;span class="katex"&gt;&lt;span class="katex-mathml"&gt;&lt;/span&gt;&lt;span class="katex-html"&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;v&lt;/span&gt;&lt;span class="mopen"&gt;[&lt;/span&gt;&lt;span class="mord"&gt;0&lt;/span&gt;&lt;span class="mclose"&gt;]&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mbin"&gt;+&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;w&lt;/span&gt;&lt;span class="mopen"&gt;[&lt;/span&gt;&lt;span class="mord"&gt;0&lt;/span&gt;&lt;span class="mclose"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/span&gt;
, second element is 
&lt;span class="katex-element"&gt;
  &lt;span class="katex"&gt;&lt;span class="katex-mathml"&gt;&lt;/span&gt;&lt;span class="katex-html"&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;v&lt;/span&gt;&lt;span class="mopen"&gt;[&lt;/span&gt;&lt;span class="mord"&gt;1&lt;/span&gt;&lt;span class="mclose"&gt;]&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mbin"&gt;+&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;w&lt;/span&gt;&lt;span class="mopen"&gt;[&lt;/span&gt;&lt;span class="mord"&gt;1&lt;/span&gt;&lt;span class="mclose"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/span&gt;
, and so on on. (If they're not the same length, we can't combine them.) &lt;/p&gt;

&lt;p&gt;Adding 
&lt;span class="katex-element"&gt;
  &lt;span class="katex"&gt;&lt;span class="katex-mathml"&gt;&lt;/span&gt;&lt;span class="katex-html"&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mopen"&gt;[&lt;/span&gt;&lt;span class="mord mathnormal"&gt;a&lt;/span&gt;&lt;span class="mpunct"&gt;,&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;b&lt;/span&gt;&lt;span class="mclose"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/span&gt;
 and 
&lt;span class="katex-element"&gt;
  &lt;span class="katex"&gt;&lt;span class="katex-mathml"&gt;&lt;/span&gt;&lt;span class="katex-html"&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mopen"&gt;[&lt;/span&gt;&lt;span class="mord mathnormal"&gt;c&lt;/span&gt;&lt;span class="mpunct"&gt;,&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;d&lt;/span&gt;&lt;span class="mclose"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/span&gt;
 will result in 
&lt;span class="katex-element"&gt;
  &lt;span class="katex"&gt;&lt;span class="katex-mathml"&gt;&lt;/span&gt;&lt;span class="katex-html"&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mopen"&gt;[&lt;/span&gt;&lt;span class="mord mathnormal"&gt;a&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mbin"&gt;+&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;c&lt;/span&gt;&lt;span class="mpunct"&gt;,&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;b&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mbin"&gt;+&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;d&lt;/span&gt;&lt;span class="mclose"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/span&gt;
.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvmi3m6md3wh37dq3m6tb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvmi3m6md3wh37dq3m6tb.png" alt="Vector in Graph" width="540" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can easily implement this by zip-ing the vectors together and using a list comprehension to add the corresponding elements:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;vector_add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;  
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;adds corresponding elements&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;  
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;v_i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;w_i&lt;/span&gt;  
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;v_i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w_i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Similarly, to subtract two vectors we just subtract corresponding elements:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;vector_subtract&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;  
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;subtracts corresponding elements&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;  
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;v_i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;w_i&lt;/span&gt;  
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;v_i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w_i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We’ll also need to be able to multiply a vector by a scalar, which we do simply by multiplying each element of the vector by that number:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;scalar_multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;  
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;c is a number, v is a vector&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;  
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;v_i&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;v_i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We also need &lt;strong&gt;&lt;em&gt;dot product&lt;/em&gt;&lt;/strong&gt; of two vectors. The dot product of two vectors is the sum of their component wise product:&lt;/p&gt;


&lt;div class="katex-element"&gt;
  &lt;span class="katex-display"&gt;&lt;span class="katex"&gt;&lt;span class="katex-mathml"&gt;&lt;/span&gt;&lt;span class="katex-html"&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;V&lt;/span&gt;&lt;span class="mord"&gt;&lt;span class="mord"&gt;⋅&lt;/span&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;W&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mrel"&gt;=&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;V&lt;/span&gt;&lt;span class="mord mathnormal"&gt;x&lt;/span&gt;&lt;span class="mord"&gt;&lt;span class="mord"&gt;⋅&lt;/span&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;W&lt;/span&gt;&lt;span class="mord mathnormal"&gt;x&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mbin"&gt;+&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;V&lt;/span&gt;&lt;span class="mord mathnormal"&gt;y&lt;/span&gt;&lt;span class="mord"&gt;&lt;span class="mord"&gt;⋅&lt;/span&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;W&lt;/span&gt;&lt;span class="mord mathnormal"&gt;y&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v_i&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;w_i&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;v_i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w_i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Another value which can be useful is the &lt;strong&gt;&lt;em&gt;Magnitude (or length)&lt;/em&gt;&lt;/strong&gt; of the vector which is square root of sum of square of values.&lt;/p&gt;


&lt;div class="katex-element"&gt;
  &lt;span class="katex-display"&gt;&lt;span class="katex"&gt;&lt;span class="katex-mathml"&gt;&lt;/span&gt;&lt;span class="katex-html"&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;ma&lt;/span&gt;&lt;span class="mord mathnormal"&gt;g&lt;/span&gt;&lt;span class="mopen"&gt;(&lt;/span&gt;&lt;span class="mord mathnormal"&gt;V&lt;/span&gt;&lt;span class="mclose"&gt;)&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mrel"&gt;=&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord sqrt"&gt;&lt;span class="vlist-t vlist-t2"&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span class="svg-align"&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="mord"&gt;&lt;span class="mopen"&gt;(&lt;/span&gt;&lt;span class="mord mathnormal"&gt;V&lt;/span&gt;&lt;span class="mord mathnormal"&gt;x&lt;/span&gt;&lt;span class="mclose"&gt;&lt;span class="mclose"&gt;)&lt;/span&gt;&lt;span class="msupsub"&gt;&lt;span class="vlist-t"&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="sizing reset-size6 size3 mtight"&gt;&lt;span class="mord mtight"&gt;2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mbin"&gt;+&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mopen"&gt;(&lt;/span&gt;&lt;span class="mord mathnormal"&gt;V&lt;/span&gt;&lt;span class="mord mathnormal"&gt;y&lt;/span&gt;&lt;span class="mclose"&gt;&lt;span class="mclose"&gt;)&lt;/span&gt;&lt;span class="msupsub"&gt;&lt;span class="vlist-t"&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="sizing reset-size6 size3 mtight"&gt;&lt;span class="mord mtight"&gt;2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="hide-tail"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="vlist-s"&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/div&gt;



&lt;p&gt;Distance between two vectors can be calculated by&lt;/p&gt;


&lt;div class="katex-element"&gt;
  &lt;span class="katex-display"&gt;&lt;span class="katex"&gt;&lt;span class="katex-mathml"&gt;&lt;/span&gt;&lt;span class="katex-html"&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;d&lt;/span&gt;&lt;span class="mord mathnormal"&gt;i&lt;/span&gt;&lt;span class="mord mathnormal"&gt;s&lt;/span&gt;&lt;span class="mord mathnormal"&gt;t&lt;/span&gt;&lt;span class="mord mathnormal"&gt;an&lt;/span&gt;&lt;span class="mord mathnormal"&gt;ce&lt;/span&gt;&lt;span class="mopen"&gt;(&lt;/span&gt;&lt;span class="mord mathnormal"&gt;V&lt;/span&gt;&lt;span class="mpunct"&gt;,&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;W&lt;/span&gt;&lt;span class="mclose"&gt;)&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mrel"&gt;=&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord sqrt"&gt;&lt;span class="vlist-t vlist-t2"&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span class="svg-align"&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="mord"&gt;&lt;span class="mopen"&gt;(&lt;/span&gt;&lt;span class="mord mathnormal"&gt;vx&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mbin"&gt;−&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;W&lt;/span&gt;&lt;span class="mord mathnormal"&gt;x&lt;/span&gt;&lt;span class="mclose"&gt;&lt;span class="mclose"&gt;)&lt;/span&gt;&lt;span class="msupsub"&gt;&lt;span class="vlist-t"&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="sizing reset-size6 size3 mtight"&gt;&lt;span class="mord mtight"&gt;2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mbin"&gt;+&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mopen"&gt;(&lt;/span&gt;&lt;span class="mord mathnormal"&gt;V&lt;/span&gt;&lt;span class="mord mathnormal"&gt;y&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mbin"&gt;−&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;W&lt;/span&gt;&lt;span class="mord mathnormal"&gt;y&lt;/span&gt;&lt;span class="mclose"&gt;&lt;span class="mclose"&gt;)&lt;/span&gt;&lt;span class="msupsub"&gt;&lt;span class="vlist-t"&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="sizing reset-size6 size3 mtight"&gt;&lt;span class="mord mtight"&gt;2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="hide-tail"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="vlist-s"&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;sum_of_squares&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;  
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;v_1 * v_1 + ... + v_n * v_n&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;  
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;magnitude&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;  
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;sum_of_squares&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;squared_distance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;  
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;(v_1 - w_1) ** 2 + ... + (v_n - w_n) ** 2&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;  
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;sum_of_squares&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;vector_subtract&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;distance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;  
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;squared_distance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Matrices
&lt;/h3&gt;

&lt;p&gt;A matrix is a two-dimensional number collection. Matrixes will be represented as lists of lists, with each inner list the same size and representing a row of the matrix. If A is a matrix, then 
&lt;span class="katex-element"&gt;
  &lt;span class="katex"&gt;&lt;span class="katex-mathml"&gt;&lt;/span&gt;&lt;span class="katex-html"&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;A&lt;/span&gt;&lt;span class="mopen"&gt;[&lt;/span&gt;&lt;span class="mord mathnormal"&gt;i&lt;/span&gt;&lt;span class="mclose"&gt;]&lt;/span&gt;&lt;span class="mopen"&gt;[&lt;/span&gt;&lt;span class="mord mathnormal"&gt;j&lt;/span&gt;&lt;span class="mclose"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/span&gt;
 is the element in the &lt;em&gt;ith&lt;/em&gt; row and the &lt;em&gt;jth&lt;/em&gt; column. Per mathematical convention, we will typically use capital letters to represent matrices.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0qys7kzkwdbp1ptrvd5r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0qys7kzkwdbp1ptrvd5r.png" alt="Matrix" width="293" height="149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Same as vectors we can represent matrix in terms of 2D list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;A&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
     &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
     &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa9yfwudw7iwb5c773j8d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa9yfwudw7iwb5c773j8d.png" alt="Note" width="798" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The matrix A contains &lt;code&gt;len(A)&lt;/code&gt; rows and &lt;code&gt;len(A[0])&lt;/code&gt; columns, which we take to be its shape given this list-of-lists representation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;n_rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;n_columns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;n_rows&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n_columns&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We shall refer to a matrix as a 
&lt;span class="katex-element"&gt;
  &lt;span class="katex"&gt;&lt;span class="katex-mathml"&gt;&lt;/span&gt;&lt;span class="katex-html"&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;n&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mbin"&gt;×&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;k&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/span&gt;
 matrix if it contains n rows and k columns. Each row of a n by k matrix can be thought of as a vector of length k, and each column as a vector of length n:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_row&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;  
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;# A[i] is already the ith row  
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_column&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;  
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;A_i&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;# jth element of row A_i  
&lt;/span&gt;            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;A_i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;A&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;# for each row A_i
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a diagonal of a matrix contains only 1s then its called &lt;em&gt;Diagonal Matrix&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb3ws9j4h6vnbv063v4me.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb3ws9j4h6vnbv063v4me.png" alt="Diagonal Matrix" width="188" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can use matrix to represent relations between different entities ex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;friendships&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;span class="c1"&gt;############# Which Can Also be Represnted as ###############
&lt;/span&gt;
&lt;span class="n"&gt;friendships&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;# user 0  
&lt;/span&gt;                &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;# user 1  
&lt;/span&gt;                &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;# user 2  
&lt;/span&gt;                &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;# user 3  
&lt;/span&gt;                &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;# user 4  
&lt;/span&gt;                &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;# user 5  
&lt;/span&gt;                &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;# user 6  
&lt;/span&gt;                &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;# user 7  
&lt;/span&gt;                &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;# user 8  
&lt;/span&gt;                &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt; &lt;span class="c1"&gt;# user 9
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If there are very few connections, this is a much more inefficient representation, since you end up having to store a lot of zeroes. However, with the matrix representation it is  much  quicker  to  check  whether two nodes are connected, you just have to do a matrix lookup instead of (potentially) inspecting every edge:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;friendships&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="c1"&gt;# True, 0 and 2 are friends  
&lt;/span&gt;&lt;span class="n"&gt;friendships&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="c1"&gt;# False, 0 and 8 are not friends
&lt;/span&gt;
&lt;span class="n"&gt;friends_of_five&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="c1"&gt;# only need  
&lt;/span&gt;                    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;is_friend&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;friendships&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="c1"&gt;# to look at  
&lt;/span&gt;                    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;is_friend&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;# one row
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fru5ofmsuqf3kke5m3fuy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fru5ofmsuqf3kke5m3fuy.png" alt="Note1" width="800" height="149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Resource
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.khanacademy.org/math/linear-algebra" rel="noopener noreferrer"&gt;https://www.khanacademy.org/math/linear-algebra&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab" rel="noopener noreferrer"&gt;https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web.stanford.edu/%7Eboyd/vmls/" rel="noopener noreferrer"&gt;https://web.stanford.edu/~boyd/vmls/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://mitran-lab.amath.unc.edu/courses/MATH347DS/textbook.pdf" rel="noopener noreferrer"&gt;http://mitran-lab.amath.unc.edu/courses/MATH347DS/textbook.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://fong.cs.wmich.edu/modules/LinearAlgebraPrimerConcepts.pdf" rel="noopener noreferrer"&gt;https://fong.cs.wmich.edu/modules/LinearAlgebraPrimerConcepts.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;This article is highly influenced by the book Data Science from Scratch by Joel Grus, this is a fantastic book to read for people getting started with data science. If you don't like reading book then save the series as there is more to come.&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>python</category>
      <category>mathematics</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Data Science: Basic Mathematics</title>
      <dc:creator>Azad Kshitij</dc:creator>
      <pubDate>Tue, 08 Nov 2022 11:30:00 +0000</pubDate>
      <link>https://dev.to/azadkshitij/data-science-basic-mathematics-2bnc</link>
      <guid>https://dev.to/azadkshitij/data-science-basic-mathematics-2bnc</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;You might be thinking how much math we need to know to get started with Data Science? There is no specific answer to that but I have the way for you to get started.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why?
&lt;/h2&gt;

&lt;p&gt;Unlike software engineering data-science is not mostly about programming, it's more about data and understanding relation between datapoints. In order to do that we need eye for that and most of us don't have that so we need &lt;strong&gt;math&lt;/strong&gt; to make sense of the data. A significant portion of your ability to translate your&amp;nbsp;data science skills&amp;nbsp;into real-world scenarios depends on your success and understanding of mathematics. Mathematical knowledge is necessary for data science careers because machine learning algorithms, data analysis, and insight discovery all depend on it. Although there are other requirements for your degree and employment in data science, math is frequently one of the most crucial.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Science 💗 Maths
&lt;/h2&gt;

&lt;p&gt;Let's talk about the most common types of math that you will use in your data science career. &lt;/p&gt;

&lt;h3&gt;
  
  
  Linear Algebra
&lt;/h3&gt;

&lt;p&gt;Linear algebra is the branch of mathematics that deals with vector spaces. It contains concept of vector, matrix etc. Linear algebra is widely used by data scientists (frequently implicitly, and not infrequently by people who don’t understand it). It wouldn’t be a bad idea to read a textbook.&lt;/p&gt;

&lt;h4&gt;
  
  
  Resource
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.khanacademy.org/math/linear-algebra" rel="noopener noreferrer"&gt;https://www.khanacademy.org/math/linear-algebra&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab" rel="noopener noreferrer"&gt;https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web.stanford.edu/%7Eboyd/vmls/" rel="noopener noreferrer"&gt;https://web.stanford.edu/~boyd/vmls/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://mitran-lab.amath.unc.edu/courses/MATH347DS/textbook.pdf" rel="noopener noreferrer"&gt;http://mitran-lab.amath.unc.edu/courses/MATH347DS/textbook.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://fong.cs.wmich.edu/modules/LinearAlgebraPrimerConcepts.pdf" rel="noopener noreferrer"&gt;https://fong.cs.wmich.edu/modules/LinearAlgebraPrimerConcepts.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Statistics &amp;amp; Probability
&lt;/h3&gt;

&lt;p&gt;Statistics refers to the mathematics and techniques with which we understand data. This is essential in machine learning when working with classifications such as logistic regression, discrimination analysis  and hypothesis testing and distributions.&lt;/p&gt;

&lt;h4&gt;
  
  
  Resource
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.khanacademy.org/math/statistics-probability" rel="noopener noreferrer"&gt;https://www.khanacademy.org/math/statistics-probability&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://seeing-theory.brown.edu/#secondPage" rel="noopener noreferrer"&gt;https://seeing-theory.brown.edu/#secondPage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=XcLO4f1i4Yo" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=XcLO4f1i4Yo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.udacity.com/course/intro-to-descriptive-statistics--ud827" rel="noopener noreferrer"&gt;https://www.udacity.com/course/intro-to-descriptive-statistics--ud827&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Calculus
&lt;/h3&gt;

&lt;p&gt;Calculus is used in machine learning to create loss/cost/objective functions, which are used to train algorithms to achieve their goals. It contains study of derivatives, curvature, divergence, and quadratic approximations. &lt;/p&gt;

&lt;h4&gt;
  
  
  Resource
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.khanacademy.org/math/multivariable-calculus" rel="noopener noreferrer"&gt;https://www.khanacademy.org/math/multivariable-calculus&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/playlist?list=PLZHQObOWTQDMsr9K-rj53DwVRMYO3t5Yr" rel="noopener noreferrer"&gt;https://www.youtube.com/playlist?list=PLZHQObOWTQDMsr9K-rj53DwVRMYO3t5Yr&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ocw.mit.edu/courses/18-01sc-single-variable-calculus-fall-2010/" rel="noopener noreferrer"&gt;https://ocw.mit.edu/courses/18-01sc-single-variable-calculus-fall-2010/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ocw.mit.edu/courses/18-02sc-multivariable-calculus-fall-2010/" rel="noopener noreferrer"&gt;https://ocw.mit.edu/courses/18-02sc-multivariable-calculus-fall-2010/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In future article we will talk about each topic in detail and how to use them and when to use them so stay tuned and save the series. If you have anything to say comment down below I'm new to blog writing so any type of feedback is appreciated Thanks.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://towardsdatascience.com/mathematics-for-data-science-e53939ee8306" rel="noopener noreferrer"&gt;https://towardsdatascience.com/mathematics-for-data-science-e53939ee8306&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.analyticsvidhya.com/blog/2021/06/how-to-learn-mathematics-for-machine-learning-what-concepts-do-you-need-to-master-in-data-science/" rel="noopener noreferrer"&gt;https://www.analyticsvidhya.com/blog/2021/06/how-to-learn-mathematics-for-machine-learning-what-concepts-do-you-need-to-master-in-data-science/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.simplilearn.com/math-and-data-science-article" rel="noopener noreferrer"&gt;https://www.simplilearn.com/math-and-data-science-article&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>datascience</category>
      <category>python</category>
      <category>beginners</category>
      <category>math</category>
    </item>
  </channel>
</rss>
