<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Parand</title><link href="https://www.parand.com/" rel="alternate"/><link href="https://www.parand.com/feeds/all.atom.xml" rel="self"/><id>https://www.parand.com/</id><updated>2026-06-11T10:22:00-07:00</updated><entry><title>The Bear Case for Frontier AI Labs</title><link href="https://www.parand.com/the-bear-case-for-frontier-ai-labs.html" rel="alternate"/><published>2026-06-11T10:22:00-07:00</published><updated>2026-06-11T10:22:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2026-06-11:/the-bear-case-for-frontier-ai-labs.html</id><summary type="html">&lt;p&gt;I suspect, but don’t have proof that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Frontier model progress will slow as we exhaust training data and known scaling methods. Gains will be incremental, not fundamental.  &lt;/li&gt;
&lt;li&gt;Performance gains will come from harness / software architecture changes (eg. MoE, internal “agents” within models, various methods for effort/thinking within the …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;I suspect, but don’t have proof that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Frontier model progress will slow as we exhaust training data and known scaling methods. Gains will be incremental, not fundamental.  &lt;/li&gt;
&lt;li&gt;Performance gains will come from harness / software architecture changes (eg. MoE, internal “agents” within models, various methods for effort/thinking within the models), not from new secret science.  &lt;/li&gt;
&lt;li&gt;The “brute-force” nature of training very large models and access to data will continue to be an advantage for the frontier labs, but this advantage will not be an uncrossable moat.  &lt;ul&gt;
&lt;li&gt;Model distillation will continue to be a reality, allowing non-frontier labs to ride the coat-tails of frontier labs.  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;There will be good-enough non-frontier models at much lower prices that lag frontier performance by ~1 year, ala DeepSeek 4.&lt;ul&gt;
&lt;li&gt;There will be meaningful progress in running these locally / on-edge.  &lt;ul&gt;
&lt;li&gt;Apple will be a fun participant here, and might end up being a surprise winner.  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Gains from harness and software architecture will be applicable to the non-frontier models, and in fact non-frontier models may lead the charge, allowing the non-frontier models to take advantage of the lower-cost gains.  &lt;/li&gt;
&lt;li&gt;The economic reality of AI spend vs real world value will hit the world front-and-center, forcing companies to evaluate and optimize their AI spend, driving many use cases to non-frontier models.  &lt;/li&gt;
&lt;li&gt;The non-frontier models will be good enough for many classes of problems, leaving the top tier frontier models with interesting but fewer real-world applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So - while I very much enjoy and encourage the era of subsidized access to great models and the speculation driven investment in training of models, I worry that we will be facing a re-adjustment and correction, with LLMs mostly becoming a utility / commodity.&lt;/p&gt;
&lt;p&gt;Therefore: I don’t have a strong enough thesis to be bullish on AI lab stocks in the long term. In the short term there will be plenty of opportunity for plenty of money making, and certainly a few very big winners will emerge, but I’m not sure how exactly it'll play out.&lt;/p&gt;
&lt;p&gt;I seem to be in the minority on this opinion, I'd love to be corrected, if I have the fundamentals wrong please let me know.&lt;/p&gt;</content><category term="Machine Learning"/><category term="machine-learning"/><category term="llm"/><category term="chatgpt"/></entry><entry><title>The AI Productivity Lie</title><link href="https://www.parand.com/the-ai-productivity-lie.html" rel="alternate"/><published>2026-04-10T08:10:00-07:00</published><updated>2026-04-10T08:10:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2026-04-10:/the-ai-productivity-lie.html</id><summary type="html">&lt;p&gt;Many (myself included) claim AI driven (or in my case, &lt;a href="https://www.parand.com/dont-be-a-tourist-in-your-own-code-base.html"&gt;assisted&lt;/a&gt;) development is resulting in massive productivity acceleration and gains. But there is some obvious and troubling evidence to the contrary.&lt;/p&gt;
&lt;p&gt;The frontier AI labs, OpenAI, Anthropic, Google, etc, are the leaders in the creation and adoption of tooling and …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Many (myself included) claim AI driven (or in my case, &lt;a href="https://www.parand.com/dont-be-a-tourist-in-your-own-code-base.html"&gt;assisted&lt;/a&gt;) development is resulting in massive productivity acceleration and gains. But there is some obvious and troubling evidence to the contrary.&lt;/p&gt;
&lt;p&gt;The frontier AI labs, OpenAI, Anthropic, Google, etc, are the leaders in the creation and adoption of tooling and systems for AI driven development - eg. &lt;a href="https://www.eweek.com/news/ai-writing-code-anthropic-openai/"&gt;Anthropic and OpenAI claim 100% of their code is written by AI&lt;/a&gt; .&lt;/p&gt;
&lt;p&gt;If so, why is the pace of innovation and updates in their AI development products (Codex, Claude Code, Antigravity) so pedestrian? Compare the rate of improvement in their products to products from other multi-billion dollar companies, or indeed to the rate of innovation before the advent of AI driven development, and you’re hard pressed to find anything justifying the claims of acceleration. The release notes are so mundane I barely care.&lt;/p&gt;
&lt;p&gt;Where are the productivity gains? I’m certainly seeing it in &lt;a href="https://www.parand.com/dont-be-a-tourist-in-your-own-code-base.html"&gt;our own development process&lt;/a&gt; - I’m absolutely convinced we’d be far behind where we are had we not embraced AI assisted development processes - but industry-wide something is amiss. &lt;/p&gt;
&lt;p&gt;I don’t have a clear thesis yet, but I’m working on a few ideas. For one, I think writing code is not the major bottleneck to development - indeed if you examine software development processes in the “enterprise” you’ll see that both from a time and resource perspective, writing code is a fraction of the overall allocation. According to IDC &lt;a href="https://www.infoworld.com/article/3831759/developers-spend-most-of-their-time-not-coding-idc-report.html"&gt;application development is only 16% of developers’ time&lt;/a&gt;. Similarly, the number of developers in “enterprise” application development is generally ¼ of the overall team size, with the PM, architecture, design, QA, security, and DevOps teams making up the remaining ¾.&lt;/p&gt;
&lt;p&gt;With AI driven or assisted development we’re optimizing a local bottleneck in a large and complex process, and are therefore constrained in how much acceleration we achieve. Future phases will need to look at the overall process holistically and optimize the entire pipeline, perhaps in the mold of Toyota Production Systems approaches (Lean, Muda, Muri, Mura, and Takt Time).&lt;/p&gt;
&lt;p&gt;I’ll explore a couple of other ideas in future posts, but I’m most curious to hear what others are seeing and thinking.&lt;/p&gt;</content><category term="Machine Learning"/><category term="llm"/><category term="programming"/></entry><entry><title>Don’t Be A Tourist In Your Own Code Base</title><link href="https://www.parand.com/dont-be-a-tourist-in-your-own-code-base.html" rel="alternate"/><published>2026-01-26T23:38:00-08:00</published><updated>2026-01-26T23:38:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2026-01-26:/dont-be-a-tourist-in-your-own-code-base.html</id><summary type="html">&lt;h1&gt;Or: Vibecoding versus LAD&lt;/h1&gt;
&lt;p&gt;Software development with the assistance of coding agents is &lt;strong&gt;incredibly&lt;/strong&gt; more productive than without - it’s the difference between building a house brick by brick yourself versus having a crew of expert tradespeople helping you.&lt;/p&gt;
&lt;p&gt;However, vibecoding isn’t quite the right approach – that’s akin …&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Or: Vibecoding versus LAD&lt;/h1&gt;
&lt;p&gt;Software development with the assistance of coding agents is &lt;strong&gt;incredibly&lt;/strong&gt; more productive than without - it’s the difference between building a house brick by brick yourself versus having a crew of expert tradespeople helping you.&lt;/p&gt;
&lt;p&gt;However, vibecoding isn’t quite the right approach – that’s akin to asking the tradespeople to design and architect your house.&lt;/p&gt;
&lt;h2&gt;Write The Spec, Let the AI Design?&lt;/h2&gt;
&lt;p&gt;Most of the recommendations I’ve seen for using coding agents involve writing the design doc and design principles and letting the AI implement the software. You specify, walk away, a swarm of coding agents implements, and you enjoy the results.&lt;/p&gt;
&lt;p&gt;I’ve tried this in earnest multiple times and it’s failed every time.&lt;/p&gt;
&lt;p&gt;The pattern is: AI writes the software and I’m overjoyed with the incredible pace of implementation. It works! Amazing!&lt;/p&gt;
&lt;p&gt;Eventually there’s a problem in the operation of the software. I give the error message or the symptoms to the coding agent, it dutifully researches the problem and tries solutions, but fails with every attempt.&lt;/p&gt;
&lt;p&gt;Now I have to deal with it myself. I crack open the code (that I supposedly reviewed before committing) and realize:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;I’m a tourist in a land of extremely mediocre code and design.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I’ve allowed a diligent but naive junior developer to design my system. I’m now charged with digging into this idiot’s code, and at every turn I curse his decisions and approach.&lt;/p&gt;
&lt;p&gt;To be fair I also curse my own decisions and idiotic approach when I look at code I have written myself, but at least I’m not a tourist. I know what’s where and why it’s there, even if it was placed there stupidly.&lt;/p&gt;
&lt;h2&gt;Is It Just Me?&lt;/h2&gt;
&lt;p&gt;I don’t think so. The number of times I’ve asked colleagues and friends why their code does X and gotten the response “I have no idea” is terrifying. &lt;/p&gt;
&lt;p&gt;You can let the AI design all your code, but I think you’re just punting the pain down the road. You write code once but you maintain it for a long time, and being a tourist is just setting you up to have your pocket picked that whole time.&lt;/p&gt;
&lt;h2&gt;Terrible At Architecture&lt;/h2&gt;
&lt;p&gt;LLMs are great at design of small things - a django model, a function, a database table. They are (currently) very bad at architectural decisions for maintainable software.&lt;/p&gt;
&lt;p&gt;Let me convince you with anecdata from the last few days:&lt;/p&gt;
&lt;h3&gt;&lt;em&gt;Big Picture Blindness&lt;/em&gt;&lt;/h3&gt;
&lt;p&gt;The LLM has implemented 3 new API endpoints, all subtle filtering variants of existing APIs. I ask it: wouldn’t it be cleaner to add filters to the existing APIs? &lt;em&gt;Oh yes you great genius, let me do that right away!&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;&lt;em&gt;The Rabbit Hole&lt;/em&gt;&lt;/h3&gt;
&lt;p&gt;There’s a subtlety in the way a sub-system has to be written (due to &lt;a href="https://temporal.io/"&gt;Temporal&lt;/a&gt; sandboxes and non-determinism rules). The LLM tries to do a reasonable thing that won’t work because of the subtlety. It correctly identifies the issue, but instead of stepping back and changing approach, &lt;em&gt;the LLM starts to rewrite the entire subsystem piece by piece trying to work around the subtlety, pursuing an approach that will never work.&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;&lt;em&gt;Plain Stupidity&lt;/em&gt;&lt;/h3&gt;
&lt;p&gt;The LLM decides to build a whole shadow API as an abstraction on top of our existing nice clean API. I still have no idea why. Why not just use the API? &lt;em&gt;Great idea you divine light of wisdom, let me do that right away!&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;What Works? LAD&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;LLM Assisted Development. LAD.&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Treat the LLM as a diligent, well meaning, extremely hardworking, but naive and inexperienced junior developer. He’s just a lad trying his best to help you, but left to his own devices he’ll make terrible big picture decisions.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pair program with the LAD. Use the AI to replace typing, not thinking&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;You&lt;/em&gt; design the software, think deeply about architecture, and plan out an incremental approach to building the system. You include the lad in this process, asking its opinion, asking it to research, having it write the design document.&lt;/p&gt;
&lt;p&gt;Then you ask the lad to implement a small step in that incremental plan, look carefully at the code as if you’re pair programming with a human, test the result, and then move to the next step.&lt;/p&gt;
&lt;h2&gt;Fun and Profit&lt;/h2&gt;
&lt;p&gt;Developing software this way is incredibly more efficient than writing code yourself. Pair programming with the LAD gives you the positives - &lt;em&gt;you&lt;/em&gt; have designed the system, &lt;em&gt;you&lt;/em&gt; understand every part of the code - and avoids the negatives of a naive, unknown, and unsustainable design.&lt;/p&gt;
&lt;p&gt;AI slop and the low quality of LLM generated software may have made you skeptical, but the answer is not to throw the baby out with the bathwater. Try it this way. Pair program. It is fun and very high quality - frankly the code I’m getting is higher quality than if I’d hand-written it, because the lad is an extremely diligent coder and has an encyclopedic knowledge of almost everything under the sun.&lt;/p&gt;</content><category term="Technical"/><category term="llm"/><category term="programming"/></entry><entry><title>Why Do Large Language Models Hallucinate?</title><link href="https://www.parand.com/why-do-large-language-models-hallucinate.html" rel="alternate"/><published>2023-05-14T09:00:00-07:00</published><updated>2023-05-14T09:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2023-05-14:/why-do-large-language-models-hallucinate.html</id><summary type="html">&lt;p&gt;The above question from my friend James (hi James!) surprised me, even though it's
an obvious and excellent question.&lt;/p&gt;
&lt;h1&gt;What Does Hallucination Mean Here?&lt;/h1&gt;
&lt;p&gt;Sometimes ChatGPT and other Large Language Models (LLMs) make things up. They will
state, with apparent confidence, things that are made up or not true. &lt;/p&gt;
&lt;p&gt;&lt;img src="/static/images/robot-thought.png"&gt;&lt;/p&gt;
&lt;p&gt;My …&lt;/p&gt;</summary><content type="html">&lt;p&gt;The above question from my friend James (hi James!) surprised me, even though it's
an obvious and excellent question.&lt;/p&gt;
&lt;h1&gt;What Does Hallucination Mean Here?&lt;/h1&gt;
&lt;p&gt;Sometimes ChatGPT and other Large Language Models (LLMs) make things up. They will
state, with apparent confidence, things that are made up or not true. &lt;/p&gt;
&lt;p&gt;&lt;img src="/static/images/robot-thought.png"&gt;&lt;/p&gt;
&lt;p&gt;My favorite example
is ChatGPT's very convincing ability to pretend it can access the internet, even though
it really can't. &lt;a href="https://simonwillison.net/2023/Mar/10/chatgpt-internet-access/"&gt;Simon Willison has a great writeup&lt;/a&gt; 
on this where he provides copious examples - for example, you can ask ChatGPT to summarize
stories that don't exist by making up URLs for those stories, and ChatGPT will
dutifully provide a summary for the non-existent stories. Try it yourself - go to
the &lt;a href="https://chat.openai.com/"&gt;ChatGPT site&lt;/a&gt; and ask it to
&lt;em&gt;"Summarize this story: https://www.nytimes.com/2023/05/03/business/made-up-headline-here.html"&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Here's my example&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
Summarize this story: https://www.theonion.com/god-scores-for-arsenal-1785001
&lt;/blockquote&gt;

&lt;p&gt;ChatGPT's response:&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
The article from The Onion satirically reports that God, the divine creator of the universe, has scored a goal for the Arsenal football club. The article describes the crowd's reaction to the divine intervention as "ecstatic" and quotes fictional players and coaches who express amazement at the event. The article pokes fun at the intense passion and excitement that football fans have for their teams by exaggerating it to a ridiculous extent, suggesting that even God is invested in the outcome of the game
&lt;/blockquote&gt;

&lt;p&gt;Here's another interesting one:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://twitter.com/CPAutoScribe/status/1654210706500374528"&gt;&lt;img src="/static/images/twitter-gpt-hallucination.png" width="600"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You'll also see ChatGPT making up references to scientific papers that don't exist, inventing facts,
and generally confidently lying to you.&lt;/p&gt;
&lt;h1&gt;Why Lie, ChatGPT?&lt;/h1&gt;
&lt;p&gt;The reason the question surprised me was: I'm shocked it ever gets things right. &lt;/p&gt;
&lt;p&gt;ChatGPT and Large Language Models are probabilistic models that are able to achieve high
levels of performance via very many rounds of training. See the &lt;a href="/a-non-technical-explanation-of-chatgpt.html"&gt;Non Technical Explanation of ChatGPT&lt;/a&gt; post for an overview - in short, they see many examples of 
human communication and learn to mimic that by creating responses one word at a time, 
picking words that are probabilistically most likely to appear next. &lt;/p&gt;
&lt;p&gt;If you've ever trained one of these systems you know that for much of its life it spews
nonsense - initially its output looks random, gradually improving to have valid structure
and grammar, then starting to have cohesive subjects, and eventually to be able to carry
concepts across sentences. The progression is: random nonsense, babbling idiot, babbling
ignoramus, simpleton, person, and finally the embodiment of all that is true and holy.&lt;/p&gt;
&lt;p&gt;My point is: until it reaches the point of enlightenment and oneness with the universe,
you expect it to get things wrong. That's the nature of a probablistic 
system that improves over time: "incorrect" outputs are to be expected.&lt;/p&gt;
&lt;p&gt;If you're technically inclined try playing around with LLMs that have lower parameter counts
or are less trained and you'll see what I mean: they frequently get things wrong or "off".
&lt;strong&gt;It's a testiment to ChatGPT's capabilities that it leapt across the uncanny valley and went
straight to all-seeing sage, giving people the expectation that it would never err.&lt;/strong&gt;&lt;/p&gt;
&lt;h1&gt;There's No Database&lt;/h1&gt;
&lt;p&gt;We are used to computer systems that give us true and consistent answers. Data is stored in
some source of truth - a database or file, for example - and software allows us to interact
with that data.&lt;/p&gt;
&lt;p&gt;In the case of LLMs there is no database. Knowledge is not explicitly stored in a source of
truth - instead it's recorded in the connections and weights of the model. When you interact
with ChatGPT it's not looking up a fact in a database and putting it into English. Instead it is
probabilistically picking words that go well together, and those words often express cohesive
and true concepts.&lt;/p&gt;
&lt;p&gt;Recall how we created ChatGPT: we trained it on a large corpus of human communication, and then
we fine-tuned it to respond in a conversational, chat-like manner, and to be helpful.&lt;/p&gt;
&lt;p&gt;When you ask it to summarize a non-existent story it does its best to find concepts that relate
to that story and to put those concepts into words. In the made-up Onion story above, it
picked up concepts based on the context it was given: it knows &lt;em&gt;TheOnion&lt;/em&gt; is a satirical website,
it knows &lt;em&gt;Arsenal&lt;/em&gt; is a football club (aided by the appearance of the word &lt;em&gt;scores&lt;/em&gt;), and it knows
what God is. Given that context it does a commendable job of fabricating those concepts into a
plausible English paragraph. It is doing exactly what we trained it to do.&lt;/p&gt;
&lt;h1&gt;What's the Fix?&lt;/h1&gt;
&lt;p&gt;There are a number of very interesting research approaches to fixing this problem that I will
not cover here - look up "LLM alignment" for a rabbit hole of philosophical and technical information.&lt;/p&gt;
&lt;p&gt;The approach I'm excited about in the short term is: give your LLM a database. &lt;/p&gt;
&lt;p&gt;The concept is simple: augment your language model with a source of truth that can inject facts
into the context (prompt) of the language model. This way the set of "concepts" the LLM is working with
directly include relevant and valid information for your query.&lt;/p&gt;
&lt;p&gt;How do we do this? One current approach is to first lookup information related to your
query in a source of truth, then to inject the results of that lookup into the prompt you
give to the LLM. For example, if you ask for a summary of a story at a given URL, you could first
download the contents of that story, inject those contents into the LLM prompt, then
include your original prompt. The LLM now has its built-in knowledge from its training, it has
the relevant facts from the lookup we did, and it has your instructions from the prompt
you provided it.&lt;/p&gt;
&lt;p&gt;Bing employs this approach in its chat interface: first it turns your prompt into a search string,
then it searches the internet for that string, then it gives the results of the search as well as
your prompt to ChatGPT.&lt;/p&gt;
&lt;p&gt;Another good example is &lt;a href="https://filechat.io/"&gt;filechat.io&lt;/a&gt;, which lets you use LLMs to interact with
your own data: you give it a set of documents, and it intelligently feeds the relevant parts
of those documents as well as your prompt to an LLM, allowing you to employ the power of ChatGPT
on your proprietary data. &lt;/p&gt;
&lt;p&gt;The application of LLMs to internal enterprise data is a fantastically exciting area, one which
promises to create a massive amount of value going forward.&lt;/p&gt;
&lt;h1&gt;Further Reading&lt;/h1&gt;
&lt;p&gt;&lt;em&gt;If you're interested in this topic you might also enjoy the other posts in the &lt;a href="/tag/explainer.html"&gt;Non-Technical Explainer&lt;/a&gt; series as well.&lt;/em&gt;&lt;/p&gt;</content><category term="Machine Learning"/><category term="explainer"/><category term="machine-learning"/><category term="llm"/><category term="chatgpt"/></entry><entry><title>A Non-Technical Explanation of ChatGPT: Deep Learning</title><link href="https://www.parand.com/a-non-technical-explanation-of-chatgpt-deep-learning.html" rel="alternate"/><published>2023-05-09T11:15:00-07:00</published><updated>2023-05-09T11:15:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2023-05-09:/a-non-technical-explanation-of-chatgpt-deep-learning.html</id><summary type="html">&lt;p&gt;This is part two of the &lt;a href="https://www.parand.com/a-non-technical-explanation-of-chatgpt.html"&gt;non-technical explanation of ChatGPT&lt;/a&gt; series, please read that first. It's also helpful to read the &lt;a href="https://www.parand.com/a-completely-non-technical-explanation-of-ai.html"&gt;non-technical explanation of AI&lt;/a&gt; so you have some background on how deep learning is used here.&lt;/p&gt;
&lt;h1&gt;Creating CatGPT&lt;/h1&gt;
&lt;p&gt;Convinced that Markov's method is a good path forward, you decide …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This is part two of the &lt;a href="https://www.parand.com/a-non-technical-explanation-of-chatgpt.html"&gt;non-technical explanation of ChatGPT&lt;/a&gt; series, please read that first. It's also helpful to read the &lt;a href="https://www.parand.com/a-completely-non-technical-explanation-of-ai.html"&gt;non-technical explanation of AI&lt;/a&gt; so you have some background on how deep learning is used here.&lt;/p&gt;
&lt;h1&gt;Creating CatGPT&lt;/h1&gt;
&lt;p&gt;Convinced that Markov's method is a good path forward, you decide to create the frequency table with 4 words 
of context for the alien cat language so you can create high quality sentences. You roll up your sleeves and get to work.&lt;/p&gt;
&lt;p&gt;A week goes by and you notice you've barely made a dent - you've filled up several notebooks with
frequency counts, and you still have so very many word combinations to go through. What's going on?&lt;/p&gt;
&lt;p&gt;How much work is necessary to create the frequency table? If we were using a single word 
as our context window and wanted to have the vocabulary of an average native English speaker (30000 words),
we'd need 30000 rows, one for each word in the English language. &lt;/p&gt;
&lt;p&gt;If we use two words of context we'd potentially be looking at the number of two word permutations of those 
30k words. That's about 900 million rows. With three words of context we could have 27 trillion
rows. That's a lot of rows. In practice the number of permutations is significantly smaller because many word 
permutations don't occur in English, but we'd still get to very large numbers very quickly.&lt;/p&gt;
&lt;p&gt;This is an unfortunate reality when dealing with combinations and permutations - increasing
the number of items you consider catastrophically increases the number of calculations you have
to do or items you have to remember. The technical term is &lt;a href="https://en.wikipedia.org/wiki/Combinatorial_explosion"&gt;&lt;em&gt;combinatorial explosion&lt;/em&gt;&lt;/a&gt;, which is a good description of how your head feels after all that counting.&lt;/p&gt;
&lt;p&gt;&lt;img src="/static/images/cat-fireworks.png"&gt;&lt;/p&gt;
&lt;p&gt;This is not good. Four words of context is not very much - something as simple as our marathon example
( I just ran a marathon. I am very _____ ) would require more context. How do we deal with the explosion?&lt;/p&gt;
&lt;p&gt;You ask Markov and he gets a sour look on his face - "Yeah, this is a a problem. I don't have a great solution."&lt;/p&gt;
&lt;h1&gt;Learning, Deeply&lt;/h1&gt;
&lt;p&gt;How do we deal with this explosion of calculation? Since we can't directly solve the problem maybe we can
wave our hands and try the magic of Deep Learning.&lt;/p&gt;
&lt;p&gt;Let's see if we can use 
&lt;a href="https://www.parand.com/a-completely-non-technical-explanation-of-ai.html"&gt;our experience from finding cats&lt;/a&gt; here. 
That also seemed a very complex problem, and we solved that using layers of workers to focus on different aspects
of the problem, and formed our final opinion based on the opinions of the layers of workers giving
us information.&lt;/p&gt;
&lt;p&gt;We have a bit of a problem though - in that case the boss was giving us the examples as well as the correct
answers. She was also giving us rewards and punishments. We don't have that here - we just have a big book of alien cat communication and a desire to create a frequency table.&lt;/p&gt;
&lt;p&gt;That's too bad - you have your slapping gloves ready to go, you were really hoping you could use the same
technique as last time.&lt;/p&gt;
&lt;h1&gt;Eureka: We can Train&lt;/h1&gt;
&lt;p&gt;What is the actual problem we're trying solve with the frequency table? We are trying to predict the next
word. Can we turn that into a problem with rewards and punishments?&lt;/p&gt;
&lt;p&gt;Yes we can!&lt;/p&gt;
&lt;p&gt;The problem we're trying to solve is: given 4 words of context, predict the next word. We tried to be
clever and use a frequency table to solve this. Let's not be clever: just like the cat classification
task, let's not define the methods and process for solving the problem - let's instead hand it
off to our layers of workers and reward and punish them until they figure it out.&lt;/p&gt;
&lt;p&gt;How do we turn our book of cat communication into a prediction task? Simple: grab any 4 words of context 
and hand them off to the group of workers and ask them to predict the next word. We know what the 
next word should be (it's just the word that followed those words in the big book of cat communication) -
if they get it right we give them a reward, if they get it wrong we give them a slap.&lt;/p&gt;
&lt;p&gt;This is great - we can open the book of alien cat communication on any page, pick 4 consecutive words, give that
to the workers, and train them on what the next word should be. Now we have our training examples
and our rewards and punishments.&lt;/p&gt;
&lt;p&gt;You grab your slapping gloves and lots of rewards and call your layers of trusty workers and start
the the training.&lt;/p&gt;
&lt;h1&gt;Deep Learning For Hard Problems&lt;/h1&gt;
&lt;p&gt;This is a great example of a situation where deep learning can be applied effectively:&lt;/p&gt;
&lt;ul class="list-disc list-inside"&gt;
    &lt;li&gt;Traditional methods (in this case, creating the exact frequency table) don't work&lt;/li&gt;
    &lt;li&gt;We have a lot of data&lt;/li&gt;
    &lt;li&gt;We can create a large number of training examples&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We have turned the task of creating a sentence into a predict-the-next-word task, and
we have turned the book of cat communication into many examples that we can train on.&lt;/p&gt;
&lt;p&gt;The architecture of the deep learning system that powers ChatGPT is quite a bit
more complex than what we discussed in the &lt;a href="https://www.parand.com/a-completely-non-technical-explanation-of-ai.html"&gt;non-technical explanation of AI&lt;/a&gt; post, but the core ideas are the same. I'll
touch on some of the technical aspects in future posts, but for now think of the same multi-layer
groups of workers where rewards / punishments are propogated back through the network to train
it to produce the desired output.&lt;/p&gt;
&lt;h1&gt;CatGPT Works. Sort Of&lt;/h1&gt;
&lt;p&gt;After lots of training you and your colleagues are getting good at predicting the next word
in the cat language, and you're enjoying the rewards. But you're a bit stuck - there's only
so much you can do with 4 words of context. Your colleagues are asking for more and more words
of context. You start to increase the context window from 4 words to 5, 6, and so on, and your 
responses start getting better. But the workers' task is also getting much more complex: as 
you give people more and more words their area of focus becomes too large - they have too many 
foreign words to look at at a time. You get to a point where each worker can't effectively focus 
on more words. Your training stalls and you're not getting as much reward as you want. Your 
colleagues start complaining about losing out on the rewards - the loss is too high!&lt;/p&gt;
&lt;h1&gt;Attention Please&lt;/h1&gt;
&lt;p&gt;Your context window has gotten too large and things are stalling. You start doing the same thing
you did with the cat classifying task: you tell each worker to focus on a small window of
words and give their opinion on that instead of looking at all the words in the context. It's
going ok, but the window of words each worker looks at isn't enough to understand the whole
context, and increasing each worker's window makes their individual task too difficult.&lt;/p&gt;
&lt;p&gt;One day one of the workers, frustrated that she can't predict the next
word, yells out "I think this word is an adverb. I can't predict the next word -  I don't
have a verb in the part of the context I'm looking at!"&lt;/p&gt;
&lt;p&gt;One of the other workers looks up. "I have a verb in my part! I've been looking for an adverb!"&lt;/p&gt;
&lt;p&gt;The two of them exchange information and both improve their predictions.&lt;/p&gt;
&lt;p&gt;Why didn't you think of that? You should let the workers communicate about the parts they're
looking into. You grab your English grammar book and start telling the workers they should 
call out the parts of speech they have. &lt;/p&gt;
&lt;p&gt;The problem is cat language doesn't follow English grammar rules, so what you're asking
for doesn't really make sense.&lt;/p&gt;
&lt;p&gt;You remember your motto: don't solve the problem in a clever way, just provide rewards and
punishments. You tell the workers: feel free to tell others the type of thing you're looking 
at and ask others for the information you need to predict the next word. &lt;/p&gt;
&lt;p&gt;"What do you mean by &lt;em&gt;type of thing you're looking at&lt;/em&gt;?" ask the workers.&lt;/p&gt;
&lt;p&gt;"I have no idea", you respond. "Whatever helps you."&lt;/p&gt;
&lt;p&gt;The workers are skeptical, but they decide to give it a try. They start telling others what
they think is relevant in the group of words they're looking at and paying attention to what 
the others are saying. It's challenging - each worker has to decide what to to say about
their piece and what to pay attention to from others - but they work out a system. 
"I think this has something to do with whiskers, and I'm looking 
for something about whether the cat's in a small or large space". "I have information about
the cat being alone and I'm trying to see if they're scared or not". "My tail is low between
my legs, does anyone have information about a threat?"&lt;/p&gt;
&lt;p&gt;A lot of what they communicate isn't useful, so they don't get rewarded for it. The workers 
focus on the information that gives them the most rewards, and because the rewards come from the 
next-word prediciton being right the whole system starts producing internal information that
leads to better predictions.&lt;/p&gt;
&lt;p&gt;Your training has gotten to the point where you're barely losing any rewards. You want 
to make sure people aren't just memorizing the whole cat communication book, so you kept
one part of the book secret during training, and you use that part to test how good 
your next-word prediction is. It's looking good. &lt;/p&gt;
&lt;p&gt;You have successfully built a Large (Cat) Language Model.&lt;/p&gt;
&lt;h1&gt;Transformers and Attention&lt;/h1&gt;
&lt;p&gt;One of the key breakthroughs that enabled the creation of sophisticated language
models was the invention of &lt;em&gt;transformers&lt;/em&gt;, which is the technical term for what we called 
&lt;em&gt;attention&lt;/em&gt; above. If you're interested in the details and examples I'd recommend
&lt;a href="https://jalammar.github.io/illustrated-transformer/"&gt;the illustrated transfomer&lt;/a&gt; and 
&lt;a href="https://towardsdatascience.com/deconstructing-bert-part-2-visualizing-the-inner-workings-of-attention-60a16d86b5c1"&gt;visualizing attention&lt;/a&gt;, both
do a great job of giving you the math and intuition.&lt;/p&gt;
&lt;p&gt;I'll steal one of the illustrated transfomer's images to give you a real world example of 
what attention looks like - the image shows what one of the "workers" is paying attention 
to in the sentence  "The animal didn't cross the street because it was too tired":&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jalammar.github.io/images/t/transformer_self-attention_visualization.png"&gt;&lt;/p&gt;
&lt;p&gt;The worker here is working on the word &lt;em&gt;it&lt;/em&gt;, and the diagram shows &lt;em&gt;it&lt;/em&gt; is paying the most
attention to &lt;em&gt;The&lt;/em&gt; and &lt;em&gt;animal&lt;/em&gt;. That makes sense: in the above sentence &lt;em&gt;it&lt;/em&gt; is referring to
&lt;em&gt;The animal&lt;/em&gt;, and the network has found a way allow that pronoun to be aware of its noun.&lt;/p&gt;
&lt;h1&gt;Cat Communication&lt;/h1&gt;
&lt;p&gt;You decide to try it out with the alien cats.&lt;/p&gt;
&lt;p&gt;&lt;img src="/static/images/alien-cat.png"&gt;&lt;/p&gt;
&lt;p&gt;The cat representative is sitting across from you. It says something. You hand that over
to your team of colleagues and they start their process of creating a response, one word
at a time. &lt;/p&gt;
&lt;p&gt;You give your response to the cat. &lt;/p&gt;
&lt;p&gt;It gives you a surprised look, and raises its tail in a let's-be-friends gesture.&lt;/p&gt;
&lt;p&gt;Back and forth, you try several exchanges, and it seems to be working - you're able to have
a "conversation". You're not sure what you or the cat are saying, but you're conversing.&lt;/p&gt;
&lt;p&gt;You notice some of your responses seem to upset the cat. You'd like to avoid that, so you
start giving feedback to your team, increasing rewards for responses that make the cat
happy and reducing rewards for responses that upset the cat. After a while your team
learns to provide its responses in a way that makes the cat happy. You call this Cat-in-Loop-Training.&lt;/p&gt;
&lt;h1&gt;Human-in-the-Loop and Fine Tuning&lt;/h1&gt;
&lt;p&gt;ChatGPT is the fastest growing application in history - it went from zero to 1 million users
in 5 days and to 100 million users in just two months.&lt;/p&gt;
&lt;p&gt;But did you know that GPT-3, the base language model that was subsequently improved to power
ChatGPT, was released in June 2020? What happend in those 2.5 years - why didn't GPT-3 capture
our imagination the way ChatGPT did?&lt;/p&gt;
&lt;p&gt;One of the main reasons was the "fine tuning" of the model based on human feedback to make it
conversational and helpful. &lt;/p&gt;
&lt;p&gt;The base language model, GPT-3, was trained on a very large amount of text from very many sources.
This taught the system to be able to create cohesive sentences and paragraphs. Think of this as
a computer that has learned to speak.&lt;/p&gt;
&lt;p&gt;The human-in-the-loop fine tuning took this base system and further trained it to have chat-like
conversations: the sentences created by the system were no longer just judged on how cohesive
and valid they were, but also on how well they mimicked a helpful conversation.&lt;/p&gt;
&lt;p&gt;ChatGPT is polite and helpful because it was trained to be that way - the language model itself
is capable of many forms of communication, including being rude and unhelpful, since the very
large amount of text it was trained on included rude and unhelpful conversations. ChatGPT
was specifically trained to be a helpful chatbot, as opposed to a sarcastic layabout.&lt;/p&gt;
&lt;p&gt;This idea of taking a base language model and further training it ("fine tuning" it) for your specific
needs is very powerful: instead of having to create a complete model from scratch, you can take 
existing models off the shelf and tune them to do what you want.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;(Another significant reason ChatGPT was so successful while GPT-3 was ignored was its easy to use and easy to understand
user interface, but we'll conveniently ignore that here)&lt;/em&gt;&lt;/p&gt;
&lt;h1&gt;CatGPT&lt;/h1&gt;
&lt;p&gt;Congratulations, you have saved humanity, communicated with aliens, and perhaps understood a bit more
about large language models and ChatGPT.&lt;/p&gt;
&lt;p&gt;&lt;img src="/static/images/man-cat-sunset.png"&gt;&lt;/p&gt;
&lt;h1&gt;Further Reading&lt;/h1&gt;
&lt;p&gt;&lt;em&gt;If you're interested in this topic you might also enjoy the other posts in the &lt;a href="/tag/explainer.html"&gt;Non-Technical Explainer&lt;/a&gt; series as well.&lt;/em&gt;&lt;/p&gt;</content><category term="Machine Learning"/><category term="explainer"/><category term="machine-learning"/><category term="llm"/></entry><entry><title>A Non-Technical Explanation of ChatGPT</title><link href="https://www.parand.com/a-non-technical-explanation-of-chatgpt.html" rel="alternate"/><published>2023-05-04T08:10:00-07:00</published><updated>2023-05-04T08:10:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2023-05-04:/a-non-technical-explanation-of-chatgpt.html</id><summary type="html">&lt;p&gt;Continuing the series of non-technical explainers, let's figure out how ChatGPT (and in general Large Language Models, 
or LLMs) work. This is part one of the ChatGPT explainer, with part two coming soon.&lt;/p&gt;
&lt;p&gt;It's helpful but not necessary to read the &lt;a href="https://www.parand.com/a-completely-non-technical-explanation-of-ai.html"&gt;non-technical explanation of AI&lt;/a&gt; first, if you feel like …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Continuing the series of non-technical explainers, let's figure out how ChatGPT (and in general Large Language Models, 
or LLMs) work. This is part one of the ChatGPT explainer, with part two coming soon.&lt;/p&gt;
&lt;p&gt;It's helpful but not necessary to read the &lt;a href="https://www.parand.com/a-completely-non-technical-explanation-of-ai.html"&gt;non-technical explanation of AI&lt;/a&gt; first, if you feel like it read that and come back.&lt;/p&gt;
&lt;h1&gt;Fill In The Blank&lt;/h1&gt;
&lt;p&gt;Let's play a quick game of fill in the blank:&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
to be or not to _____
&lt;/blockquote&gt;

&lt;p&gt;Why did you immediately think of the word &lt;em&gt;be&lt;/em&gt; to fill in that blank, instead of the word &lt;em&gt;banana&lt;/em&gt; or &lt;em&gt;fish&lt;/em&gt;? Because you've seen the phrase many times and your brain has learned the most likely next word is &lt;em&gt;be&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Let's do another one:&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
rock and ____
&lt;/blockquote&gt;

&lt;p&gt;Did you think of the word &lt;em&gt;roll&lt;/em&gt;? Why? Because that's the word you see most often following the words &lt;em&gt;rock and&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;How about this one:&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
I am very _____
&lt;/blockquote&gt;

&lt;p&gt;This is less clear - the next word depends on the context.&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
I just ran a marathon. I am very _____
&lt;/blockquote&gt;

&lt;p&gt;Perhaps now you would say &lt;em&gt;tired&lt;/em&gt;. Or &lt;em&gt;happy&lt;/em&gt;, or &lt;em&gt;proud&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Your brain is picking the most likely next word based on the context of the sentence and based on what words it's seen most frequently in that context.&lt;/p&gt;
&lt;h1&gt;Aliens and CatGPT&lt;/h1&gt;
&lt;p&gt;In an astonishing turn of events a race of alien cats have landed on earth. Since you are &lt;a href="https://www.parand.com/a-completely-non-technical-explanation-of-ai.html"&gt;the world's foremost cat expert&lt;/a&gt; you have been chosen to communicate with them.&lt;/p&gt;
&lt;p&gt;&lt;img src="/static/images/alien-cat.png"&gt;&lt;/p&gt;
&lt;p&gt;Your boss walks in and drops a massive print out of all the alien cat communications on your desk.&lt;/p&gt;
&lt;p&gt;"Speak cat!" she commands.&lt;/p&gt;
&lt;p&gt;Unfortunately you don't speak alien cat.&lt;/p&gt;
&lt;p&gt;You page through the print outs - it looks like pages and pages of gibberish.&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
zoog zeeg zag.
zoog zeeg kaz.
zoog zeeg bah.
rag zoog zeeg.
rag zoog ko.
kaz rag.
zap zoog zeeg.
...
&lt;/blockquote&gt;

&lt;h1&gt;Markov to the Rescue&lt;/h1&gt;
&lt;p&gt;What to do? You remember your friend Markov who's always talking about languages, words,
and their relationships. Maybe he can help. You show him the alien cat communications and
ask him if he can help you say something in cat.&lt;/p&gt;
&lt;p&gt;"Yes!" he exclaims - "We can do this. We will create our response one word at a time, just
by picking the best word to say next, and keep going until we have a sentence"&lt;/p&gt;
&lt;p&gt;"But how do we know what the best word to say next is? Don't we need to know what the words 
mean?"&lt;/p&gt;
&lt;p&gt;"Nope, we just need to know what word to say next"&lt;/p&gt;
&lt;p&gt;"That... doesn't seem like it would work"&lt;/p&gt;
&lt;p&gt;"Let me show you", says Markov, and grabs the book on his desk, 
&lt;a href="https://www.gutenberg.org/ebooks/11"&gt;Alice in Wonderland&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="/static/images/alice-in-wonderland-cat.png"&gt;&lt;/p&gt;
&lt;p&gt;"We just need to know what word to say next. The best word to say next is simply
the word that shows up most frequently after the word we're looking at. All we
have to do is make a table of how often each word follows another word. We'll call
this a frequency table"&lt;/p&gt;
&lt;p&gt;He shows you how to create the frequency table - you just note down how many times each word follows another.
It takes a while to go through all Alice in Wonderland and do the counting. You end up with:&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
&lt;pre&gt;Next word after "Alice" → was: 17 times,  and: 16 times,  thought: 12 times,  had: 11 times, ...
Next word after "sat" → down: 9 times,  silent: 2 times,  still: 2 times,  for: 1 times, ...
Next word after "was" → a: 31 times,  the: 20 times,  not: 12 times,  going: 11 times, ...
Next word after "and" → the: 80 times,  she: 52 times,  then: 31 times,  was: 19 times, ...
Next word after "a" → little: 59 times,  very: 25 times,  large: 20 times,  great: 17 times
Next word after "very" → much: 10 times,  soon: 7 times,  curious: 6 times,  glad: 5 times
...
&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This table gives you a lot of help in forming sentences in the style of Alice in Wonderland. 
For example, if you start with the word &lt;em&gt;Alice&lt;/em&gt;, then you'd look that up in the above table
and see that the most frequent next word is &lt;em&gt;was&lt;/em&gt;. And after &lt;em&gt;was&lt;/em&gt; you would select &lt;em&gt;a&lt;/em&gt;. After &lt;em&gt;a&lt;/em&gt;
you would get &lt;em&gt;little&lt;/em&gt;. You'd end up with &lt;em&gt;Alice was a little&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;How well does this work? Let's create some sentences:&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
the door, when i beg your verdict," it was quite plainly through the bottle, i'm afraid that they had its nest.
&lt;/blockquote&gt;

&lt;p&gt;You can try this out for yourself on &lt;a href="http://almeopedia.com/markovtest.html"&gt;almeopedia&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;That's not great. Why is it so nonsensical? Think back to our fill in the blank examples at the start of 
this post: in order to pick a good next word you need context. If someone asked you what word should 
appear after &lt;em&gt;rock&lt;/em&gt;, you'd have a hard time picking something reasonable, but if they gave you 
&lt;em&gt;rock and&lt;/em&gt;, you'd fairly quickly think of &lt;em&gt;roll&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;What would happen if you considered two words instead of a single word for your context? 
For one thing your frequency table creation would become harder - now instead of a single line for
each word, you'd have a line for each word pair. You'd have to gather stats for all the two word 
permutations, which is a lot more than the single word case.&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
&lt;pre&gt;Next word after "Alice was" → not: 3 times,  beginning: 2 times,  very: 2 times, ...
Next word after "was not" → a: 3 times,  here: 1 times,  going: 1 times ...
Next word after "not here" → before: 1 times
Next word after "not a" → moment: 2 times,  bit: 2 times,  serpent: 2 times
&lt;/pre&gt;
...
&lt;/blockquote&gt;

&lt;p&gt;Let's create a sentence with this and see how it looks:&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
the hatter, and, burning with curiosity, she decided on going into the garden.
&lt;/blockquote&gt;

&lt;p&gt;You can try this out for yourself on &lt;a href="http://www.almeopedia.com/markov3test.html"&gt;almeopedia&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;That's looking better, it almost makes sense. Let's keep going - instead of two words
of context, how about three? &lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
The Hatter’s remark seemed to have no sort of chance of her ever getting out of the water, and seemed to quiver all over with diamonds, and walked two and two, as the soldiers did.
&lt;/blockquote&gt;

&lt;p&gt;Four?&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
So she swallowed one of the cakes, and was delighted to find that she knew the name of nearly everything there.
&lt;/blockquote&gt;

&lt;p&gt;Hmm. This is a little too good. It turns out a very similar sentence exists in the original Alice in Wonderland text:&lt;/p&gt;
&lt;blockquote class="p-4 my-4 border-l-2 border-gray-300 bg-gray-200"&gt;
So she swallowed one of the cakes, and was delighted to find that she
began shrinking directly.
&lt;/blockquote&gt;

&lt;p&gt;Our simple method of picking the most likely next word can result in the system memorizing the text snippets -
given long enough context, the next most likely word is exactly the word that appeared in the original text 
following that context. &lt;/p&gt;
&lt;p&gt;We can fix this by introducing some randomness - instead of always picking the most likely next word, we can
pick somewhat likely next words. This way we're less likely to regurgitate the original text.&lt;/p&gt;
&lt;p&gt;The good news is our method seems to work for English, so it'll probably work for alien cat language as well.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Aside: You might run into the term "stochastic" as you look into language models - this just means randomly determined.
For example, you might hear people argue whether these systems are &lt;strong&gt;Stochastic Parrots&lt;/strong&gt;, implying the systems
are simply parroting back the original text that they saw, with some randomness thrown in.
&lt;/i&gt;&lt;/p&gt;
&lt;h1&gt;Large Language Models&lt;/h1&gt;
&lt;p&gt;ChatGPT and many other Large Language Models (LLMs) do essentially what you did above: they examine
a very large amount of human communication, gather stats (or probabilities) on what words are most likely 
to follow other words, and play a continous game of fill-in-the-blank. You give them some context (your prompt or
question), and they create the reply one word at a time by selecting the word most likely to appear next.
They respond with a word, then look at their internal stats to pick a word to follow their first word, then
a word to follow their second word, and so forth, one word at a time, until they've formed a response.&lt;/p&gt;
&lt;h1&gt;To be Continued...&lt;/h1&gt;
&lt;p&gt;In &lt;a href="/a-non-technical-explanation-of-chatgpt-deep-learning.html"&gt;part two of this series&lt;/a&gt; we'll look at the problems you'll run into with this method and how deep learning helps you overcome those problems.&lt;/p&gt;
&lt;h1&gt;Further Reading&lt;/h1&gt;
&lt;p&gt;&lt;em&gt;If you're interested in this topic you might also enjoy the other posts in the &lt;a href="/tag/explainer.html"&gt;Non-Technical Explainer&lt;/a&gt; series as well.&lt;/em&gt;&lt;/p&gt;</content><category term="Machine Learning"/><category term="explainer"/><category term="machine-learning"/><category term="llm"/></entry><entry><title>The Parable of the Physics Professor</title><link href="https://www.parand.com/the-parable-of-the-physics-professor.html" rel="alternate"/><published>2023-04-21T23:38:00-07:00</published><updated>2023-04-21T23:38:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2023-04-21:/the-parable-of-the-physics-professor.html</id><summary type="html">&lt;p&gt;One of my undergrad physics professors gave notoriously difficult exams, including an extra-point question that was truly challenging.&lt;/p&gt;
&lt;p&gt;A brainiac friend of mine managed to get the extra-point question completely correct. Almost. He screwed up the decimal point, incorrectly putting it two places to the right.&lt;/p&gt;
&lt;p&gt;The professor gave him …&lt;/p&gt;</summary><content type="html">&lt;p&gt;One of my undergrad physics professors gave notoriously difficult exams, including an extra-point question that was truly challenging.&lt;/p&gt;
&lt;p&gt;A brainiac friend of mine managed to get the extra-point question completely correct. Almost. He screwed up the decimal point, incorrectly putting it two places to the right.&lt;/p&gt;
&lt;p&gt;The professor gave him zero points.&lt;/p&gt;
&lt;p&gt;My friend was incensed - he did all of the many steps of this very difficult problem correctly, just misplaced the decimal point, and got zero points.&lt;/p&gt;
&lt;p&gt;We went to the professor to appeal. The professor's response was: the answer to this question is a temperature. The temperature you got is hotter than the surface of the sun. As a physicist you should've immediately known that's not the right answer. I'm giving you zero points because &lt;strong&gt;the point is not to do the steps, the point is to understand the world&lt;/strong&gt;.&lt;/p&gt;</content><category term="Misc"/><category term="misc"/></entry><entry><title>A Completely Non-Technical Explanation of AI and Deep Learning</title><link href="https://www.parand.com/a-completely-non-technical-explanation-of-ai.html" rel="alternate"/><published>2023-04-14T23:38:00-07:00</published><updated>2023-04-14T23:38:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2023-04-14:/a-completely-non-technical-explanation-of-ai.html</id><summary type="html">&lt;h1&gt;Overview&lt;/h1&gt;
&lt;p&gt;This document will explain what neural networks are and how they work, which will help you
understand how AI and machine learning work. In the scenario below you'll play the part of 
the neural network.&lt;/p&gt;
&lt;h1&gt;Day One&lt;/h1&gt;
&lt;p&gt;First day of your new job as a "classifier" your boss walks …&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Overview&lt;/h1&gt;
&lt;p&gt;This document will explain what neural networks are and how they work, which will help you
understand how AI and machine learning work. In the scenario below you'll play the part of 
the neural network.&lt;/p&gt;
&lt;h1&gt;Day One&lt;/h1&gt;
&lt;p&gt;First day of your new job as a "classifier" your boss walks in and drops a big spreadsheet of 
numbers on your desk.&lt;/p&gt;
&lt;p&gt;"Is this a cat?" she asks.&lt;/p&gt;
&lt;p&gt;Confused you ask "What?"&lt;/p&gt;
&lt;p&gt;&lt;img src="/static/images/neural-cat.png"&gt;&lt;/p&gt;
&lt;p&gt;"Is this a cat?"&lt;/p&gt;
&lt;p&gt;Even more confused, you respond "I don't know".&lt;/p&gt;
&lt;p&gt;"Wrong!" she says, and slaps you across the face.&lt;/p&gt;
&lt;p&gt;Before you've had a chance to be shocked she drops another large spreadsheet on your desk. "Is this a cat?"&lt;/p&gt;
&lt;p&gt;"I don't understand" you respond.&lt;/p&gt;
&lt;p&gt;"Wrong!" she says, and slaps you again.&lt;/p&gt;
&lt;p&gt;Another spreadsheet. "Is this a cat?"&lt;/p&gt;
&lt;p&gt;Not wanting another slap, you meekly respond "Yes?"&lt;/p&gt;
&lt;p&gt;"Correct! Good job!" she says, and gives you a wonderful reward. Almost makes up for the slaps.&lt;/p&gt;
&lt;p&gt;Another spreadsheet. Cat?&lt;/p&gt;
&lt;p&gt;Slightly more confident and wanting another reward you respond "Yes"&lt;/p&gt;
&lt;p&gt;"Wrong!". Another slap.&lt;/p&gt;
&lt;p&gt;You are very confused. "I don't understand what's going on. You haven't told me the rules,
you haven't told me how to figure out something is a cat, you haven't given me the logic
to figure this out. You haven't trained me."&lt;/p&gt;
&lt;p&gt;"Correct" says the boss. "This is training. Trust me, you're going to get very good at 
recognizing cats"&lt;/p&gt;
&lt;p&gt;&lt;img src="/static/images/woman-carrot-stick.png"&gt;&lt;/p&gt;
&lt;p&gt;Another spreadsheet. This time you focus on the sheet. It's 256 columns and 256 rows, filled
with numbers. Is it a cat? You don't know, so you guess. &lt;/p&gt;
&lt;p&gt;Another and another. Right, wrong, wrong, right again, it keeps going. Slaps and rewards. &lt;/p&gt;
&lt;p&gt;You're starting to notice some patterns - if the sheet is almost all zeros then it's not a cat.
You look at the center of the sheet - that part should have larger numbers. &lt;/p&gt;
&lt;p&gt;It's getting slightly better - you're getting more rewards than slaps, guessing correctly more
often than not. It's all about the patterns of the numbers.&lt;/p&gt;
&lt;h1&gt;Day Two&lt;/h1&gt;
&lt;p&gt;This is the strangest job you've ever had. The slaps are terrible, but the rewards are so great
you don't want to quit. How do you get better at this? It's not really possible for one person. 
If you had more people they could focus on different aspects of the sheet,
look for different patterns, and you could use their findings to make better guesses. &lt;/p&gt;
&lt;p&gt;You hire 10 people and bring them to work the next day. When you get a spreadsheet you show it
to those 10 people and ask them "Is this a cat?"&lt;/p&gt;
&lt;p&gt;They are as confused as you were. You force them to guess. The first guy looks like an idiot, 
so you decide to go with the opposite of what he says. The third lady looks really thoughtful 
so you put a lot of weight on what she says. In your mind you assign a weight to each of 
their guesses to come up with your final answer.&lt;/p&gt;
&lt;p&gt;Each time you get a reward or punishment you share it with the 10 people you've hired: you
reward or slap them based on how much weight you put on their input and how much they contributed
to you getting the answer right or wrong. You learn the patterns: if the first guy says a strong
no and the third lady a strong yes then it's very likely a cat. You learn many more patterns
like this.&lt;/p&gt;
&lt;p&gt;The 10 people are learning to hone their opinions based on the rewards and punishments they get.
They can focus on different aspects of the sheet, and their opinions together can tell you a lot
about the sheet.&lt;/p&gt;
&lt;p&gt;After what feels like an epoch and a lot of spreadsheets, eventually you get better.
You're getting more rewards. This is working. Your boss says you're very perceptive, and
starts calling you Perceptron.&lt;/p&gt;
&lt;p&gt;&lt;img src="/static/images/man-people.png"&gt;&lt;/p&gt;
&lt;h1&gt;Day Ten&lt;/h1&gt;
&lt;p&gt;What if you get more people involved? You could make it 50 people reporting to you, but that'd
be hard to manage. How about we add another layer of people before your 10?&lt;/p&gt;
&lt;p&gt;You hire 50 more people, have them give their guesses to the 10 people that report to you. 
You're now very removed from looking at the spreadsheets - instead you rely on the patterns
found by the first layer of the people, who give their opinions to the second layer of the people,
who then inform you. Everybody passes the slaps and rewards down the line based on how much
each earlier person's guess contributed to their guess.&lt;/p&gt;
&lt;p&gt;It takes even longer, but eventually the system starts working. You're much more accurate in
identifying when it's a cat. &lt;/p&gt;
&lt;p&gt;Interestingly you were never taught the rules or logic, and you didn't teach your people the
logic or rules. You just propagated the rewards and punishments back through each layer: the
more each person's opinion contributes to the answer, the more rewards or punishment you shared
with them, and they in turn with the people in the layer behind them. Each person uses the same
method to propogate their rewards and punishment back to the people in the layer below them.&lt;/p&gt;
&lt;h1&gt;Neural Networks&lt;/h1&gt;
&lt;p&gt;This is how neural networks work: they see many examples and get rewarded or punished based on
whether their guesses are correct. They use multiple layers of workers and eventually
learn patterns. Importantly no one is teaching them what patterns they should be looking for
or telling them the logic or the rules - the networks eventually figure out the patterns and
logic based on very many rounds of example, reward, and punishment. This is called 
&lt;strong&gt;machine learning&lt;/strong&gt;, because the machine is learning the rules by itself.&lt;/p&gt;
&lt;p&gt;Neural networks work well when you have many examples of something (eg. pictures of cats), but
it's hard to write the logic and rules to describe how to recognize that thing. Try it - write
down some rules for how to recognize a cat (eg. "has 4 legs"), then look at pictures of cats
and see where the rules fail (eg. a picture of a cat's head). In these cases you use machine 
learning so the machine learns the rules by itself.&lt;/p&gt;
&lt;p&gt;Also note that computers see things as multi-dimensional tables of data. They don't look
at a "picture" - they see 3 spreadsheets of numbers representing the RGB values of the picture.&lt;/p&gt;
&lt;h1&gt;Day Forty&lt;/h1&gt;
&lt;p&gt;Identifying cats is a lucrative business and you're pretty good at it. But not good enough. 
How can we get even better? More people, more layers!&lt;/p&gt;
&lt;p&gt;Unfortunately it takes a long time for people to do their calculations, so you've been stuck 
with just a few layers of people for a while. Having a lot more people would make the process
take too long.&lt;/p&gt;
&lt;p&gt;One day you run into a group of people who call themselves Gaming People United (GPU). 
These people play a game that has taught them to be very good at looking at spreadsheets and 
calculating numbers - in fact they can do a lot of calculations in parallel, very quickly.&lt;/p&gt;
&lt;p&gt;Excited, you hire a bunch of them and put them to work recognizing cats. Now instead of two
layers of people you can have 10! Each layer can focus on higher and higher concepts - 
the first layer can look for small details (eg. do I see a pattern that looks like a small 
circle? Do I see a pattern that looks like a sharp edge?), the second layer can look for patterns
from the results of the first layer (eg. are there two circles close to each other), 
the third layer can build on that (eg. are there two circle close to each other, and a 
triangle below them), and so forth. By the time the results of the layers get to you you have
some fairly sophisticated concepts - we see a pattern that looks like a face, 
we also see patterns that could be legs, and a sharp thing that might be a beak. Now your
guess is more informed than ever.&lt;/p&gt;
&lt;p&gt;You train the layers sending slaps and rewards down through each layer, and after many epochs
you get really good at recognizing cats.&lt;/p&gt;
&lt;p&gt;&lt;img src="/static/images/man-cat.png"&gt;&lt;/p&gt;
&lt;h1&gt;Deep Learning&lt;/h1&gt;
&lt;p&gt;One of the major break-throughs in machine learning was the advent of &lt;em&gt;Deep Learning&lt;/em&gt;,
which is basically what we describe above - GPUs (Graphics Processing Units) got popular
because they enable fast 3D graphics for games. They also happen to be very good at
quickly doing the types of calculations neural networks need. Machine learning people
started using GPUs for training neural networks, and with this extra speed they
could have many more layers - from 3 or 4 layers to 10 or 11, and then hundreds. &lt;/p&gt;
&lt;p&gt;This addition of layers led to significant advances in neural network performance - very
quickly neural networks became the best solution for voice recognition, for image
recognition, image creation, and sophisticated language models. This is called 
&lt;strong&gt;Deep Learning&lt;/strong&gt; because there are so many layers, not because it's profound.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;You can stop reading here if you want, the following portion is only here because someone
asked me what "convolutional neural networks" are.&lt;/em&gt;&lt;/p&gt;
&lt;h1&gt;Day Fifty&lt;/h1&gt;
&lt;p&gt;How can we make the process even more efficient? You start to realize that looking at
the entire sheet is too hard - the first layer of people literally have to stare at the
whole thing and try to guess based on that. What if we give them a small portion of the
sheet to look at, give a guess for that portion, then move on to the next portion of 
the sheet, and so on? The first layer of people are focused on lower level concepts
anyway - looking for edges, things that look like circles, and so forth - and they 
can find those in the small portions of the sheet, without the need to look at
the whole thing at once.&lt;/p&gt;
&lt;figure&gt;
    &lt;img src="https://iq.opengenus.org/content/images/2020/04/Convolving.gif" width="400"&gt;
    &lt;figcaption&gt;&lt;a href="https://towardsdatascience.com/intuitively-understanding-convolutions-for-deep-learning-1f6f42faee1"&gt;Via towardsdatascience&lt;/a&gt;&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;You tell the first layer of people this is what they should start doing. They respond
that this sounds very convoluted and they'll only agree to do it if you call
them "colonel". &lt;/p&gt;
&lt;p&gt;This makes the process even faster and more accurate: the first layer become specialists
in small features of the sheet, and they learn to be very efficient and fast. You try 
the same idea for the next several layers: you tell people to focus on small portions of
the feedback they get from the layer below them, moving the portion they focus on so 
eventually the scan across all of the feedback.&lt;/p&gt;
&lt;p&gt;This specialization and focus makes you even more accurate. Congratulations, you are 
officially recognized as the best cat classifier in the world.&lt;/p&gt;
&lt;h1&gt;Convolutional Neural Networks&lt;/h1&gt;
&lt;p&gt;Convolutions are this idea of applying a specific set of calculations, sometimes called
a kernel, to each portion of the input, and scanning your window of attention across the
entire image. The set of calculations, or kernel, is learned by each worker - you don't
tell it what to calculate or how, it learns what's useful based on rewards and punishments.
Convolutional Neural Networks (CNNs) were a significant step forward in the capability of
neural networks.&lt;/p&gt;
&lt;h1&gt;Further Reading&lt;/h1&gt;
&lt;p&gt;&lt;em&gt;If you're interested in this topic you might also enjoy the other posts in the &lt;a href="/tag/explainer.html"&gt;Non-Technical Explainer&lt;/a&gt; series as well.&lt;/em&gt;&lt;/p&gt;</content><category term="Machine Learning"/><category term="explainer"/><category term="machine-learning"/></entry><entry><title>A Practical Introduction to Polars for Python Data Processing</title><link href="https://www.parand.com/a-practical-introduction-to-polars.html" rel="alternate"/><published>2023-02-18T23:33:00-08:00</published><updated>2023-02-18T23:33:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2023-02-18:/a-practical-introduction-to-polars.html</id><summary type="html">&lt;p&gt;&lt;a href="https://www.pola.rs/"&gt;Polars&lt;/a&gt; is a "lightning-fast DataFrame library for Rust and Python" - if you're familiar with &lt;a href="https://pandas.pydata.org/"&gt;Pandas&lt;/a&gt;, Polars is quite similar but significantly faster and with a cleaner API. This post is a brief tour of how to set up and use Polars, working through a pragmatic example of the things you …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;a href="https://www.pola.rs/"&gt;Polars&lt;/a&gt; is a "lightning-fast DataFrame library for Rust and Python" - if you're familiar with &lt;a href="https://pandas.pydata.org/"&gt;Pandas&lt;/a&gt;, Polars is quite similar but significantly faster and with a cleaner API. This post is a brief tour of how to set up and use Polars, working through a pragmatic example of the things you might do in a typical data exploration project.&lt;/p&gt;
&lt;h2&gt;The Setup&lt;/h2&gt;
&lt;p&gt;Install polars and jupyter:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;python3 -m venv venv
source venv/bin/activate
pip install polars notebook
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This sets up a python virtual environment, then installs the Polars library as well as jupyter. The page you're looking at was created as a jupyter notebook.&lt;/p&gt;
&lt;h2&gt;The Data&lt;/h2&gt;
&lt;p&gt;I'm using the &lt;a href="https://www.nyc.gov/site/tlc/about/tlc-trip-record-data.page"&gt;New York Taxi Dataset&lt;/a&gt; parquet files in this notebook. I downloaded the &lt;em&gt;October 2022 Yellow Taxi Trip Records (PARQUET)&lt;/em&gt; file, feel free to grab that as well.&lt;/p&gt;
&lt;p&gt;The data is in parquet format, which is quite a nice format for data processing, significantly better than CSV.&lt;/p&gt;
&lt;h2&gt;Polars&lt;/h2&gt;
&lt;p&gt;Let's import polars and read the file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;polars&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nn"&gt;pl&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;fname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;yellow_tripdata_2022-10.parquet&amp;quot;&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;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read_parquet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fname&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Let's see what it looks like&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;head&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (5, 19)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
VendorID
&lt;/th&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
tpep_dropoff_datetime
&lt;/th&gt;
&lt;th&gt;
passenger_count
&lt;/th&gt;
&lt;th&gt;
trip_distance
&lt;/th&gt;
&lt;th&gt;
RatecodeID
&lt;/th&gt;
&lt;th&gt;
store_and_fwd_flag
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
payment_type
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;th&gt;
extra
&lt;/th&gt;
&lt;th&gt;
mta_tax
&lt;/th&gt;
&lt;th&gt;
tip_amount
&lt;/th&gt;
&lt;th&gt;
tolls_amount
&lt;/th&gt;
&lt;th&gt;
improvement_surcharge
&lt;/th&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
congestion_surcharge
&lt;/th&gt;
&lt;th&gt;
airport_fee
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:03:41
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:18:39
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.7
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
249
&lt;/td&gt;
&lt;td&gt;
107
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
9.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.65
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
15.95
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:14:30
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:19:48
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
0.72
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
151
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
5.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
9.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:27:13
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:37:41
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.74
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
166
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
9.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.06
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
12.36
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:32:53
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:38:55
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.3
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
142
&lt;/td&gt;
&lt;td&gt;
239
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
6.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.05
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
12.35
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:44:55
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:50:21
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
166
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
6.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
1.8
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
9.1
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;What are the columns in this file?&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;VendorID&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;tpep_pickup_datetime&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;tpep_dropoff_datetime&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;passenger_count&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;trip_distance&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;RatecodeID&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;store_and_fwd_flag&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;PULocationID&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;DOLocationID&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;payment_type&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;fare_amount&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;extra&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;mta_tax&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;tip_amount&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;tolls_amount&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;improvement_surcharge&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;total_amount&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;congestion_surcharge&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="nx"&gt;airport_fee&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Pretty easy to guess what the columns mean. &lt;/p&gt;
&lt;p&gt;Let's poke around a little bit - what's the average taxi fare in NYC?&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;22.247540895418666&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I wonder how many passengers there are in each ride?&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;passenger_count&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;1.3846936672698376&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;How about the average fare from the airport? I noticed the &lt;code&gt;airport_fee&lt;/code&gt; column, let's look at average &lt;code&gt;total_amount&lt;/code&gt; when the airport fee is greater than zero:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;airport_fee&amp;#39;&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;0&lt;/span&gt; &lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;55.83249747837022&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;How about the average non-airport ride cost?&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;airport_fee&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;18.957161390687517&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2&gt;Most expensive rides&lt;/h2&gt;
&lt;p&gt;Let's see what the most expensive fares in this data set are. We'll sort the data by &lt;code&gt;total_amount&lt;/code&gt; and look at the top 10.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;most_expensive&lt;/span&gt; &lt;span class="o"&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;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reverse&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;\
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;head&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="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;select&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;PULocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;DOLocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;most_expensive&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (10, 3)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
1301.85
&lt;/td&gt;
&lt;td&gt;
39
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
950.3
&lt;/td&gt;
&lt;td&gt;
226
&lt;/td&gt;
&lt;td&gt;
226
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
950.3
&lt;/td&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
870.6
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
800.3
&lt;/td&gt;
&lt;td&gt;
140
&lt;/td&gt;
&lt;td&gt;
229
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
750.3
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
750.3
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
639.8
&lt;/td&gt;
&lt;td&gt;
68
&lt;/td&gt;
&lt;td&gt;
193
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
636.55
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
606.36
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;I'm selecting just the 3 columns I'm interested in so it's easier to look at the data - the amount and pick up and drop off locations.&lt;/p&gt;
&lt;p&gt;Note the coding style above: I split the query into separate lines so it's easier to read. I've become a stickler when it comes to query / code style - you'll thank yourself for keeping it clean when you come back months later and try to figure out what you were doing.&lt;/p&gt;
&lt;p&gt;We can make it even cleaner if we use the paranthesis syntax:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;most_expensive&lt;/span&gt; &lt;span class="o"&gt;=&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;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reverse&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;head&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="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;select&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;PULocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;DOLocationID&amp;quot;&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;I wasn't crazy about the above syntax at first, but once I started using it I really liked it. &lt;/p&gt;
&lt;p&gt;Also notice the style of computation here - we're chaining the actions, one after another, javascript style: sort, then take 10 rows, then select the columns we want. This I also like.&lt;/p&gt;
&lt;p&gt;Looking at the data, apparently somebody paid \$1,301.85 for a single ride. I wonder where they went to? Let's find out.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;PULocationID&lt;/code&gt; and &lt;code&gt;DOLocationID&lt;/code&gt; are the pick up and drop off location IDs. They're just numbers right now, not too informative. Let's convert them to names.&lt;/p&gt;
&lt;h2&gt;Zone Names&lt;/h2&gt;
&lt;p&gt;We need a mapping from the Zone IDs to the Zone names. From the &lt;a href="https://www.nyc.gov/site/tlc/about/tlc-trip-record-data.page"&gt;NYC TLC Data page&lt;/a&gt;, look for the &lt;em&gt;Taxi Zone Lookup Table (CSV)&lt;/em&gt; link and download the CSV file.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;zone_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;taxi+_zone_lookup.csv&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;zone_data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;head&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (10, 4)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
LocationID
&lt;/th&gt;
&lt;th&gt;
Borough
&lt;/th&gt;
&lt;th&gt;
Zone
&lt;/th&gt;
&lt;th&gt;
service_zone
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
&amp;quot;EWR&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Newark Airport...
&lt;/td&gt;
&lt;td&gt;
&amp;quot;EWR&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Jamaica Bay&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Boro Zone&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
3
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Bronx&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Allerton/Pelha...
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Boro Zone&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Alphabet City&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Yellow Zone&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
5
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Staten Island&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Arden Heights&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Boro Zone&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
6
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Staten Island&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Arrochar/Fort ...
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Boro Zone&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
7
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Astoria&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Boro Zone&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
8
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Astoria Park&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Boro Zone&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
9
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Auburndale&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Boro Zone&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
10
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Baisley Park&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Boro Zone&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Ok, that's helpful, but I'd rather have the &lt;code&gt;Zone&lt;/code&gt; and &lt;code&gt;Borough&lt;/code&gt; together in a single column so it has all the info I need.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;zone_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;zone_data&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;with_column&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Borough&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;: &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Zone&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Location&amp;quot;&lt;/span&gt;&lt;span class="p"&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;select&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;LocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Location&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;zone_data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;head&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (10, 2)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
LocationID
&lt;/th&gt;
&lt;th&gt;
Location
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
&amp;quot;EWR: Newark Ai...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Jamaic...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
3
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Bronx: Allerto...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Alp...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
5
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Staten Island:...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
6
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Staten Island:...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
7
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Astori...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
8
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Astori...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
9
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Auburn...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
10
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Baisle...
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Ok, that's looking pretty good. Now let's look at those expensive rides again, but add in the pick up and drop off location names.&lt;/p&gt;
&lt;p&gt;To do this I'll join the &lt;code&gt;most_expensive&lt;/code&gt; dataframe I created above, which just had the fare and pick up and drop off IDs, with the &lt;code&gt;zone_data&lt;/code&gt; dataframe which has the zone names. First I'll join the &lt;code&gt;PULocationID&lt;/code&gt; with the zone data, add the location name, and rename the column from &lt;code&gt;Location&lt;/code&gt; to &lt;code&gt;PickUpLocation&lt;/code&gt;, then I'll do the same with the &lt;code&gt;DOLocationID&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The left join below means use the rows from the left dataframe, which is the &lt;code&gt;most_expensive&lt;/code&gt; dataframe, and injects into those rows the &lt;code&gt;Location&lt;/code&gt; names from the &lt;code&gt;zone_data&lt;/code&gt; dataframe, joining on &lt;code&gt;LocationID&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;most_expensive_rides&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;most_expensive&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;zone_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;how&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;left&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;left_on&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;PULocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right_on&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;LocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rename&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Location&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;PickUpLocation&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;zone_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;how&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;left&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;left_on&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;DOLocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right_on&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;LocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rename&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Location&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;DropOffLocation&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;most_expensive_rides&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (10, 5)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
PickUpLocation
&lt;/th&gt;
&lt;th&gt;
DropOffLocation
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
1301.85
&lt;/td&gt;
&lt;td&gt;
39
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Brooklyn: Cana...
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
950.3
&lt;/td&gt;
&lt;td&gt;
226
&lt;/td&gt;
&lt;td&gt;
226
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Sunnys...
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Sunnys...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
950.3
&lt;/td&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Woodsi...
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Woodsi...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
870.6
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
800.3
&lt;/td&gt;
&lt;td&gt;
140
&lt;/td&gt;
&lt;td&gt;
229
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Len...
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Sut...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
750.3
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
750.3
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
639.8
&lt;/td&gt;
&lt;td&gt;
68
&lt;/td&gt;
&lt;td&gt;
193
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Eas...
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Queens...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
636.55
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: LaGuar...
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: LaGuar...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
606.36
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
64
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Alp...
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Dougla...
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;The location names are getting cut off when we view the dataframe - let's configure the output to show wider columns&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="n"&gt;set_fmt_str_lengths&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;most_expensive_rides&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (10, 5)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
PickUpLocation
&lt;/th&gt;
&lt;th&gt;
DropOffLocation
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
1301.85
&lt;/td&gt;
&lt;td&gt;
39
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Brooklyn: Canarsie&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
950.3
&lt;/td&gt;
&lt;td&gt;
226
&lt;/td&gt;
&lt;td&gt;
226
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Sunnyside&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Sunnyside&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
950.3
&lt;/td&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Woodside&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Woodside&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
870.6
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
800.3
&lt;/td&gt;
&lt;td&gt;
140
&lt;/td&gt;
&lt;td&gt;
229
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Lenox Hill East&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Sutton Place/Turtle Bay North&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
750.3
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
750.3
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Unknown: NA&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
639.8
&lt;/td&gt;
&lt;td&gt;
68
&lt;/td&gt;
&lt;td&gt;
193
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: East Chelsea&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Queensbridge/Ravenswood&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
636.55
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: LaGuardia Airport&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: LaGuardia Airport&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
606.36
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
64
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Alphabet City&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Douglaston&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;Unknown: NA&lt;/code&gt; locations are not very useful, let's get rid of them. I'll filter the data so they're excluded.&lt;/p&gt;
&lt;p&gt;Location ID of 256 means &lt;code&gt;Unknown: NA&lt;/code&gt;, so we need to get rid of any row that has 256 in the &lt;code&gt;PULocationID&lt;/code&gt; or &lt;code&gt;DOLocationID&lt;/code&gt; columns.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;clean_data&lt;/span&gt; &lt;span class="o"&gt;=&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;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; 
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;PULocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;265&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;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;DOLocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;265&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;clean_data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;head&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (5, 19)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
VendorID
&lt;/th&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
tpep_dropoff_datetime
&lt;/th&gt;
&lt;th&gt;
passenger_count
&lt;/th&gt;
&lt;th&gt;
trip_distance
&lt;/th&gt;
&lt;th&gt;
RatecodeID
&lt;/th&gt;
&lt;th&gt;
store_and_fwd_flag
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
payment_type
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;th&gt;
extra
&lt;/th&gt;
&lt;th&gt;
mta_tax
&lt;/th&gt;
&lt;th&gt;
tip_amount
&lt;/th&gt;
&lt;th&gt;
tolls_amount
&lt;/th&gt;
&lt;th&gt;
improvement_surcharge
&lt;/th&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
congestion_surcharge
&lt;/th&gt;
&lt;th&gt;
airport_fee
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:03:41
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:18:39
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.7
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
249
&lt;/td&gt;
&lt;td&gt;
107
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
9.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.65
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
15.95
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:14:30
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:19:48
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
0.72
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
151
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
5.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
9.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:27:13
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:37:41
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.74
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
166
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
9.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.06
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
12.36
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:32:53
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:38:55
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.3
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
142
&lt;/td&gt;
&lt;td&gt;
239
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
6.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.05
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
12.35
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:44:55
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:50:21
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
166
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
6.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
1.8
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
9.1
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Ok, now we can look at the most expensive rides again, with the Unknown locations removed&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;most_expensive&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;clean_data&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reverse&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;head&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="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;select&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;PULocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;DOLocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;most_expensive&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (10, 3)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
950.3
&lt;/td&gt;
&lt;td&gt;
226
&lt;/td&gt;
&lt;td&gt;
226
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
950.3
&lt;/td&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
800.3
&lt;/td&gt;
&lt;td&gt;
140
&lt;/td&gt;
&lt;td&gt;
229
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
639.8
&lt;/td&gt;
&lt;td&gt;
68
&lt;/td&gt;
&lt;td&gt;
193
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
636.55
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
606.36
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
64
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
590.05
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
550.3
&lt;/td&gt;
&lt;td&gt;
100
&lt;/td&gt;
&lt;td&gt;
48
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
505.3
&lt;/td&gt;
&lt;td&gt;
76
&lt;/td&gt;
&lt;td&gt;
76
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
502.8
&lt;/td&gt;
&lt;td&gt;
79
&lt;/td&gt;
&lt;td&gt;
132
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Let's add the location names back in. I'll create a function to do this so we can use it whenever we need.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_location_names&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&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;data&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;zone_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;how&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;left&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;left_on&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;PULocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right_on&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;LocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rename&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Location&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;PickUpLocation&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;zone_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;how&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;left&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;left_on&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;DOLocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right_on&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;LocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rename&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Location&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;DropOffLocation&amp;quot;&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;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;add_location_names&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;most_expensive&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (10, 5)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
PickUpLocation
&lt;/th&gt;
&lt;th&gt;
DropOffLocation
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
950.3
&lt;/td&gt;
&lt;td&gt;
226
&lt;/td&gt;
&lt;td&gt;
226
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Sunnyside&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Sunnyside&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
950.3
&lt;/td&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Woodside&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Woodside&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
800.3
&lt;/td&gt;
&lt;td&gt;
140
&lt;/td&gt;
&lt;td&gt;
229
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Lenox Hill East&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Sutton Place/Turtle Bay North&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
639.8
&lt;/td&gt;
&lt;td&gt;
68
&lt;/td&gt;
&lt;td&gt;
193
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: East Chelsea&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Queensbridge/Ravenswood&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
636.55
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: LaGuardia Airport&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: LaGuardia Airport&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
606.36
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
64
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Alphabet City&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Douglaston&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
590.05
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Upper West Side North&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;EWR: Newark Airport&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
550.3
&lt;/td&gt;
&lt;td&gt;
100
&lt;/td&gt;
&lt;td&gt;
48
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Garment District&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Clinton East&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
505.3
&lt;/td&gt;
&lt;td&gt;
76
&lt;/td&gt;
&lt;td&gt;
76
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Brooklyn: East New York&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Brooklyn: East New York&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
502.8
&lt;/td&gt;
&lt;td&gt;
79
&lt;/td&gt;
&lt;td&gt;
132
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: East Village&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: JFK Airport&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Hmm. Somebody paid \$950.3 to go from Queens: Sunnyside to Queens: Sunnyside. Same for Woodside. There was also an \$800 ride from Lenox Hill East to Sutton Place, which according to Google is a 4 minute car ride.&lt;/p&gt;
&lt;p&gt;I'm starting to think our data might have junk in it. Exciting - finding junk in you data means you're doing Data Science&amp;trade;. Now we just have to throw in some Excel and we'll have Machine Learning&amp;trade;.&lt;/p&gt;
&lt;p&gt;There's a lot we could do from here. For example, we could calculate the average fare by pick up and drop off location. Or we can look at the impact of pick up time on fares (there's a &lt;code&gt;tpep_pickup_datetime&lt;/code&gt; column in the data).&lt;/p&gt;
&lt;p&gt;For some reason I decided it'd be interesting to see which pickup-dropoff location pairs have the highest variation in fare. We can figure this out by grouping the data by &lt;code&gt;("PULocationID", "DOLocationID")&lt;/code&gt;, then calculating the standard deviation for each grouping, and looking at the locations with the highest deviation.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;amount_stddevs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;clean_data&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;groupby&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;PULocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;DOLocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;agg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount_stddev&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&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;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount_stddev&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reverse&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;amount_stddevs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (20, 3)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
total_amount_stddev
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
16
&lt;/td&gt;
&lt;td&gt;
175
&lt;/td&gt;
&lt;td&gt;
219.899498
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
192
&lt;/td&gt;
&lt;td&gt;
129
&lt;/td&gt;
&lt;td&gt;
190.126871
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;td&gt;
223
&lt;/td&gt;
&lt;td&gt;
155.620968
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
93
&lt;/td&gt;
&lt;td&gt;
192
&lt;/td&gt;
&lt;td&gt;
137.885822
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
98
&lt;/td&gt;
&lt;td&gt;
98
&lt;/td&gt;
&lt;td&gt;
137.461869
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
194
&lt;/td&gt;
&lt;td&gt;
129
&lt;/td&gt;
&lt;td&gt;
137.14336
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
55
&lt;/td&gt;
&lt;td&gt;
132
&lt;/td&gt;
&lt;td&gt;
130.249069
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
50
&lt;/td&gt;
&lt;td&gt;
182
&lt;/td&gt;
&lt;td&gt;
129.223764
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;td&gt;
129
&lt;/td&gt;
&lt;td&gt;
122.231773
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
206
&lt;/td&gt;
&lt;td&gt;
206
&lt;/td&gt;
&lt;td&gt;
120.172797
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
68
&lt;/td&gt;
&lt;td&gt;
193
&lt;/td&gt;
&lt;td&gt;
119.954706
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
250
&lt;/td&gt;
&lt;td&gt;
250
&lt;/td&gt;
&lt;td&gt;
119.445285
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
19
&lt;/td&gt;
&lt;td&gt;
19
&lt;/td&gt;
&lt;td&gt;
118.451447
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
85
&lt;/td&gt;
&lt;td&gt;
28
&lt;/td&gt;
&lt;td&gt;
115.611959
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
137
&lt;/td&gt;
&lt;td&gt;
201
&lt;/td&gt;
&lt;td&gt;
114.268456
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
223
&lt;/td&gt;
&lt;td&gt;
174
&lt;/td&gt;
&lt;td&gt;
111.510739
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
92
&lt;/td&gt;
&lt;td&gt;
252
&lt;/td&gt;
&lt;td&gt;
110.662211
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
132
&lt;/td&gt;
&lt;td&gt;
184
&lt;/td&gt;
&lt;td&gt;
107.047076
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
164
&lt;/td&gt;
&lt;td&gt;
187
&lt;/td&gt;
&lt;td&gt;
104.368961
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
209
&lt;/td&gt;
&lt;td&gt;
117
&lt;/td&gt;
&lt;td&gt;
103.060813
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Let's add the location names:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;add_location_names&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount_stddevs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (20, 5)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
total_amount_stddev
&lt;/th&gt;
&lt;th&gt;
PickUpLocation
&lt;/th&gt;
&lt;th&gt;
DropOffLocation
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
16
&lt;/td&gt;
&lt;td&gt;
175
&lt;/td&gt;
&lt;td&gt;
219.899498
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Bayside&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Oakland Gardens&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
192
&lt;/td&gt;
&lt;td&gt;
129
&lt;/td&gt;
&lt;td&gt;
190.126871
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Queensboro Hill&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Jackson Heights&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;td&gt;
223
&lt;/td&gt;
&lt;td&gt;
155.620968
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Woodside&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Steinway&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
93
&lt;/td&gt;
&lt;td&gt;
192
&lt;/td&gt;
&lt;td&gt;
137.885822
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Flushing Meadows-Corona Park&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Queensboro Hill&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
98
&lt;/td&gt;
&lt;td&gt;
98
&lt;/td&gt;
&lt;td&gt;
137.461869
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Fresh Meadows&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Fresh Meadows&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
194
&lt;/td&gt;
&lt;td&gt;
129
&lt;/td&gt;
&lt;td&gt;
137.14336
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Randalls Island&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Jackson Heights&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
55
&lt;/td&gt;
&lt;td&gt;
132
&lt;/td&gt;
&lt;td&gt;
130.249069
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Brooklyn: Coney Island&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: JFK Airport&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
50
&lt;/td&gt;
&lt;td&gt;
182
&lt;/td&gt;
&lt;td&gt;
129.223764
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Clinton West&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Bronx: Parkchester&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
260
&lt;/td&gt;
&lt;td&gt;
129
&lt;/td&gt;
&lt;td&gt;
122.231773
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Woodside&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Jackson Heights&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
206
&lt;/td&gt;
&lt;td&gt;
206
&lt;/td&gt;
&lt;td&gt;
120.172797
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Staten Island: Saint George/New Brighton&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Staten Island: Saint George/New Brighton&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
68
&lt;/td&gt;
&lt;td&gt;
193
&lt;/td&gt;
&lt;td&gt;
119.954706
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: East Chelsea&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Queensbridge/Ravenswood&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
250
&lt;/td&gt;
&lt;td&gt;
250
&lt;/td&gt;
&lt;td&gt;
119.445285
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Bronx: Westchester Village/Unionport&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Bronx: Westchester Village/Unionport&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
19
&lt;/td&gt;
&lt;td&gt;
19
&lt;/td&gt;
&lt;td&gt;
118.451447
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Bellerose&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Bellerose&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
85
&lt;/td&gt;
&lt;td&gt;
28
&lt;/td&gt;
&lt;td&gt;
115.611959
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Brooklyn: Erasmus&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Briarwood/Jamaica Hills&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
137
&lt;/td&gt;
&lt;td&gt;
201
&lt;/td&gt;
&lt;td&gt;
114.268456
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Kips Bay&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Rockaway Park&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
223
&lt;/td&gt;
&lt;td&gt;
174
&lt;/td&gt;
&lt;td&gt;
111.510739
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Steinway&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Bronx: Norwood&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
92
&lt;/td&gt;
&lt;td&gt;
252
&lt;/td&gt;
&lt;td&gt;
110.662211
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Flushing&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Whitestone&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
132
&lt;/td&gt;
&lt;td&gt;
184
&lt;/td&gt;
&lt;td&gt;
107.047076
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: JFK Airport&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Bronx: Pelham Bay Park&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
164
&lt;/td&gt;
&lt;td&gt;
187
&lt;/td&gt;
&lt;td&gt;
104.368961
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Midtown South&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Staten Island: Port Richmond&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
209
&lt;/td&gt;
&lt;td&gt;
117
&lt;/td&gt;
&lt;td&gt;
103.060813
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Manhattan: Seaport&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Queens: Hammels/Arverne&amp;quot;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;That's... less interesting than I thought it would be. I suppose the absolute values are pretty interesting - our top hit, Queens: Bayside to Queens: Oakland Gardens, is about a 5 minute car ride and has a standard deviatiion of \$220. That seems suspect.&lt;/p&gt;
&lt;p&gt;This much standard deviation means we have bad data. &lt;/p&gt;
&lt;h2&gt;Data Exploration and Cleansing&lt;/h2&gt;
&lt;p&gt;A lot of real-world data work involves cleaning data and finding outliers, so let's try that with this data.&lt;/p&gt;
&lt;p&gt;There are a number of techniques for finding outliers, but first let's take a better look at our data. Polars has a built-in &lt;code&gt;describe&lt;/code&gt; function that calculates basic statistics for your dataframe:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (7, 20)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
describe
&lt;/th&gt;
&lt;th&gt;
VendorID
&lt;/th&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
tpep_dropoff_datetime
&lt;/th&gt;
&lt;th&gt;
passenger_count
&lt;/th&gt;
&lt;th&gt;
trip_distance
&lt;/th&gt;
&lt;th&gt;
RatecodeID
&lt;/th&gt;
&lt;th&gt;
store_and_fwd_flag
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
payment_type
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;th&gt;
extra
&lt;/th&gt;
&lt;th&gt;
mta_tax
&lt;/th&gt;
&lt;th&gt;
tip_amount
&lt;/th&gt;
&lt;th&gt;
tolls_amount
&lt;/th&gt;
&lt;th&gt;
improvement_surcharge
&lt;/th&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
congestion_surcharge
&lt;/th&gt;
&lt;th&gt;
airport_fee
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;count&amp;quot;
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
&amp;quot;3675411&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;3675411&amp;quot;
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
&amp;quot;3675411&amp;quot;
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;td&gt;
3.675411e6
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;null_count&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;0&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;0&amp;quot;
&lt;/td&gt;
&lt;td&gt;
133021.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
133021.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;133021&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
133021.0
&lt;/td&gt;
&lt;td&gt;
133021.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;mean&amp;quot;
&lt;/td&gt;
&lt;td&gt;
1.720443
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
1.384694
&lt;/td&gt;
&lt;td&gt;
6.206977
&lt;/td&gt;
&lt;td&gt;
1.424337
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
165.498365
&lt;/td&gt;
&lt;td&gt;
162.891786
&lt;/td&gt;
&lt;td&gt;
1.188275
&lt;/td&gt;
&lt;td&gt;
15.299953
&lt;/td&gt;
&lt;td&gt;
0.987793
&lt;/td&gt;
&lt;td&gt;
0.487229
&lt;/td&gt;
&lt;td&gt;
2.859254
&lt;/td&gt;
&lt;td&gt;
0.583306
&lt;/td&gt;
&lt;td&gt;
0.295531
&lt;/td&gt;
&lt;td&gt;
22.247541
&lt;/td&gt;
&lt;td&gt;
2.28062
&lt;/td&gt;
&lt;td&gt;
0.103128
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;std&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.480032
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.930231
&lt;/td&gt;
&lt;td&gt;
640.823768
&lt;/td&gt;
&lt;td&gt;
5.685591
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
65.213026
&lt;/td&gt;
&lt;td&gt;
70.197474
&lt;/td&gt;
&lt;td&gt;
0.540651
&lt;/td&gt;
&lt;td&gt;
14.674444
&lt;/td&gt;
&lt;td&gt;
1.242828
&lt;/td&gt;
&lt;td&gt;
0.101155
&lt;/td&gt;
&lt;td&gt;
3.374175
&lt;/td&gt;
&lt;td&gt;
2.111967
&lt;/td&gt;
&lt;td&gt;
0.051038
&lt;/td&gt;
&lt;td&gt;
18.368245
&lt;/td&gt;
&lt;td&gt;
0.75784
&lt;/td&gt;
&lt;td&gt;
0.347974
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;min&amp;quot;
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2008-12-31 23:02:01.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2009-01-01 02:20:59.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-1294.5
&lt;/td&gt;
&lt;td&gt;
-22.18
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-100.01
&lt;/td&gt;
&lt;td&gt;
-70.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-1301.85
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
-1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;max&amp;quot;
&lt;/td&gt;
&lt;td&gt;
6.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-11-01 01:27:35.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-11-03 17:26:46.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
9.0
&lt;/td&gt;
&lt;td&gt;
389678.46
&lt;/td&gt;
&lt;td&gt;
99.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Y&amp;quot;
&lt;/td&gt;
&lt;td&gt;
265.0
&lt;/td&gt;
&lt;td&gt;
265.0
&lt;/td&gt;
&lt;td&gt;
4.0
&lt;/td&gt;
&lt;td&gt;
1294.5
&lt;/td&gt;
&lt;td&gt;
10.8
&lt;/td&gt;
&lt;td&gt;
25.48
&lt;/td&gt;
&lt;td&gt;
500.0
&lt;/td&gt;
&lt;td&gt;
516.75
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1301.85
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;median&amp;quot;
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.9
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
162.0
&lt;/td&gt;
&lt;td&gt;
162.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
10.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.22
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
16.55
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;That's pretty helpful - for example, the minimum pick up date is &lt;code&gt;2008-12-31&lt;/code&gt;, which means this data starts all the way back to 2009. Because of the way the TLC data download page is organized I thought I only had data from October 2023.&lt;/p&gt;
&lt;p&gt;The largest tip amount is \$500 (&lt;code&gt;max&lt;/code&gt; of the &lt;code&gt;tip_amount&lt;/code&gt; column). The minimum tip is \$-100.01. Must've been a pretty rough ride.&lt;/p&gt;
&lt;p&gt;Looking at the &lt;code&gt;total_amount&lt;/code&gt; column we see that the maximum ride amount was \$1301.85 and the minimum was -\$1301.85. I don't know much about this data, but I'm going to guess that's an incorrectly charged ride and a refund. That's unfortunate - having large invalid data (\$1301.85 and -\$1301.85) at either extreme of values will wreak havoc on our standard deviations and such.&lt;/p&gt;
&lt;p&gt;The longest ride (&lt;code&gt;max&lt;/code&gt; of the &lt;code&gt;trip_distance&lt;/code&gt; field) is 389678.46. Is that in miles? Let's look at the &lt;a href="https://www.nyc.gov/assets/tlc/downloads/pdf/data_dictionary_trip_records_yellow.pdf"&gt;data dictionary&lt;/a&gt; provided by the TLC. &lt;/p&gt;
&lt;p&gt;&lt;img alt="Screenshot%202023-01-16%20at%207.15.01%20AM.png" src="/static/images/nyctaxi-info.png"&gt;&lt;/p&gt;
&lt;p&gt;It is in fact in miles. The length of the United States is about 3000 miles, so this enterprising taxi travelled the entire US about 130 times.&lt;/p&gt;
&lt;p&gt;The data dictionary tells us a lot of other useful things - for example, the &lt;code&gt;Payment_type&lt;/code&gt; column should help us find disputed, voided, and other invalid charges.&lt;/p&gt;
&lt;h2&gt;Basic Cleaning&lt;/h2&gt;
&lt;p&gt;So what should we do? I'm thinking we look at more recent data, say anything 2020 and after. Let's get rid of anything with more than 3000 miles, and let's also get rid of rows with unreasonable negative numbers - eg. negative total amounts, tolls, etc. We can get rid of rows where the &lt;code&gt;Payment_type&lt;/code&gt; is No Charge, Dispute, Voided, etc.&lt;/p&gt;
&lt;p&gt;The trouble is if we just get rid of the negative amounts and disputes then we're leaving the corresponding equally invalid positive amount in the data - eg. if we drop the row that has the -\$1301.85 amount we'll still have the \$1301.85 row in our data.&lt;/p&gt;
&lt;p&gt;We'll have to figure out how to drop both: for each of the negative numbers, we'll need to find the corresponding positive amount and get rid of those rows too.&lt;/p&gt;
&lt;p&gt;Let's take a look at the outlier data and see if spot any clues for how to get rid of them.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&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;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount&amp;quot;&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;1300&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;total_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1300&lt;/span&gt;&lt;span class="p"&gt;)&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;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (2, 19)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
VendorID
&lt;/th&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
tpep_dropoff_datetime
&lt;/th&gt;
&lt;th&gt;
passenger_count
&lt;/th&gt;
&lt;th&gt;
trip_distance
&lt;/th&gt;
&lt;th&gt;
RatecodeID
&lt;/th&gt;
&lt;th&gt;
store_and_fwd_flag
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
payment_type
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;th&gt;
extra
&lt;/th&gt;
&lt;th&gt;
mta_tax
&lt;/th&gt;
&lt;th&gt;
tip_amount
&lt;/th&gt;
&lt;th&gt;
tolls_amount
&lt;/th&gt;
&lt;th&gt;
improvement_surcharge
&lt;/th&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
congestion_surcharge
&lt;/th&gt;
&lt;th&gt;
airport_fee
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-12 07:00:43
&lt;/td&gt;
&lt;td&gt;
2022-10-12 12:31:57
&lt;/td&gt;
&lt;td&gt;
4.0
&lt;/td&gt;
&lt;td&gt;
259.33
&lt;/td&gt;
&lt;td&gt;
4.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
39
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
-1294.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-6.55
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-1301.85
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-12 07:00:43
&lt;/td&gt;
&lt;td&gt;
2022-10-12 12:31:57
&lt;/td&gt;
&lt;td&gt;
4.0
&lt;/td&gt;
&lt;td&gt;
259.33
&lt;/td&gt;
&lt;td&gt;
4.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
39
&lt;/td&gt;
&lt;td&gt;
265
&lt;/td&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
1294.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
6.55
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
1301.85
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;The payment type is 2, which is cash. Somebody paid $1300 in cash, then got it handed back to him. I was hoping the payment type would be Voided or something reasonable.&lt;/p&gt;
&lt;p&gt;Getting rid of these invalid pairs is going to be a bit painful - we'll have to find each invalid ride and also find its pair.&lt;/p&gt;
&lt;p&gt;Before we do that, let's see if the problems still exists in data we care about, which is data from 2020 onwards.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;tpep_pickup_datetime&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;2020&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;Warning&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Comparing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="sr"&gt;/datetime/&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;will&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lead&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;comparison&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;unlikely&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;what&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;you&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;want&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;span class="n"&gt;If&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;intended&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;consider&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;using&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;an&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;explicit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;cast&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;silence&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;warning&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (7, 20)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
describe
&lt;/th&gt;
&lt;th&gt;
VendorID
&lt;/th&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
tpep_dropoff_datetime
&lt;/th&gt;
&lt;th&gt;
passenger_count
&lt;/th&gt;
&lt;th&gt;
trip_distance
&lt;/th&gt;
&lt;th&gt;
RatecodeID
&lt;/th&gt;
&lt;th&gt;
store_and_fwd_flag
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
payment_type
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;th&gt;
extra
&lt;/th&gt;
&lt;th&gt;
mta_tax
&lt;/th&gt;
&lt;th&gt;
tip_amount
&lt;/th&gt;
&lt;th&gt;
tolls_amount
&lt;/th&gt;
&lt;th&gt;
improvement_surcharge
&lt;/th&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
congestion_surcharge
&lt;/th&gt;
&lt;th&gt;
airport_fee
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;count&amp;quot;
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
&amp;quot;3675407&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;3675407&amp;quot;
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
&amp;quot;3675407&amp;quot;
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;null_count&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;0&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;0&amp;quot;
&lt;/td&gt;
&lt;td&gt;
133021.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
133021.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;133021&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
133021.0
&lt;/td&gt;
&lt;td&gt;
133021.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;mean&amp;quot;
&lt;/td&gt;
&lt;td&gt;
1.720442
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
1.384694
&lt;/td&gt;
&lt;td&gt;
6.206973
&lt;/td&gt;
&lt;td&gt;
1.424337
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
165.498365
&lt;/td&gt;
&lt;td&gt;
162.891771
&lt;/td&gt;
&lt;td&gt;
1.188275
&lt;/td&gt;
&lt;td&gt;
15.299922
&lt;/td&gt;
&lt;td&gt;
0.987794
&lt;/td&gt;
&lt;td&gt;
0.487229
&lt;/td&gt;
&lt;td&gt;
2.859248
&lt;/td&gt;
&lt;td&gt;
0.583304
&lt;/td&gt;
&lt;td&gt;
0.295531
&lt;/td&gt;
&lt;td&gt;
22.247504
&lt;/td&gt;
&lt;td&gt;
2.280621
&lt;/td&gt;
&lt;td&gt;
0.103127
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;std&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.480032
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.930231
&lt;/td&gt;
&lt;td&gt;
640.824117
&lt;/td&gt;
&lt;td&gt;
5.685594
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
65.213049
&lt;/td&gt;
&lt;td&gt;
70.197445
&lt;/td&gt;
&lt;td&gt;
0.540651
&lt;/td&gt;
&lt;td&gt;
14.674414
&lt;/td&gt;
&lt;td&gt;
1.242828
&lt;/td&gt;
&lt;td&gt;
0.101155
&lt;/td&gt;
&lt;td&gt;
3.374169
&lt;/td&gt;
&lt;td&gt;
2.111966
&lt;/td&gt;
&lt;td&gt;
0.051038
&lt;/td&gt;
&lt;td&gt;
18.368208
&lt;/td&gt;
&lt;td&gt;
0.757839
&lt;/td&gt;
&lt;td&gt;
0.347973
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;min&amp;quot;
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-09-30 14:06:36.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-09-30 14:23:04.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-1294.5
&lt;/td&gt;
&lt;td&gt;
-22.18
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-100.01
&lt;/td&gt;
&lt;td&gt;
-70.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-1301.85
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
-1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;max&amp;quot;
&lt;/td&gt;
&lt;td&gt;
6.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-11-01 01:27:35.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-11-03 17:26:46.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
9.0
&lt;/td&gt;
&lt;td&gt;
389678.46
&lt;/td&gt;
&lt;td&gt;
99.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Y&amp;quot;
&lt;/td&gt;
&lt;td&gt;
265.0
&lt;/td&gt;
&lt;td&gt;
265.0
&lt;/td&gt;
&lt;td&gt;
4.0
&lt;/td&gt;
&lt;td&gt;
1294.5
&lt;/td&gt;
&lt;td&gt;
10.8
&lt;/td&gt;
&lt;td&gt;
25.48
&lt;/td&gt;
&lt;td&gt;
500.0
&lt;/td&gt;
&lt;td&gt;
516.75
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1301.85
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;median&amp;quot;
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.9
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
162.0
&lt;/td&gt;
&lt;td&gt;
162.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
10.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.22
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
16.55
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;That didn't work - our &lt;code&gt;min tpep_pickup_datetime&lt;/code&gt; is &lt;code&gt;2022-09-30&lt;/code&gt; (I was expecting 2020). I guess I can't filter a &lt;code&gt;datetime&lt;/code&gt; column (&lt;code&gt;tpep_pickup_datetime&lt;/code&gt;) using a string ("2020"). Makes sense, let's fix it.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;
&lt;span class="n"&gt;start_date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2020&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="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Filtering data to start at &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&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;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;tpep_pickup_datetime&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;start_date&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Filtering data to start at 2020-01-01 00:00:00
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (7, 20)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
describe
&lt;/th&gt;
&lt;th&gt;
VendorID
&lt;/th&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
tpep_dropoff_datetime
&lt;/th&gt;
&lt;th&gt;
passenger_count
&lt;/th&gt;
&lt;th&gt;
trip_distance
&lt;/th&gt;
&lt;th&gt;
RatecodeID
&lt;/th&gt;
&lt;th&gt;
store_and_fwd_flag
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
payment_type
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;th&gt;
extra
&lt;/th&gt;
&lt;th&gt;
mta_tax
&lt;/th&gt;
&lt;th&gt;
tip_amount
&lt;/th&gt;
&lt;th&gt;
tolls_amount
&lt;/th&gt;
&lt;th&gt;
improvement_surcharge
&lt;/th&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
congestion_surcharge
&lt;/th&gt;
&lt;th&gt;
airport_fee
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;count&amp;quot;
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
&amp;quot;3675407&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;3675407&amp;quot;
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
&amp;quot;3675407&amp;quot;
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;td&gt;
3.675407e6
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;null_count&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;0&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;0&amp;quot;
&lt;/td&gt;
&lt;td&gt;
133021.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
133021.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;133021&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
133021.0
&lt;/td&gt;
&lt;td&gt;
133021.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;mean&amp;quot;
&lt;/td&gt;
&lt;td&gt;
1.720442
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
1.384694
&lt;/td&gt;
&lt;td&gt;
6.206973
&lt;/td&gt;
&lt;td&gt;
1.424337
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
165.498365
&lt;/td&gt;
&lt;td&gt;
162.891771
&lt;/td&gt;
&lt;td&gt;
1.188275
&lt;/td&gt;
&lt;td&gt;
15.299922
&lt;/td&gt;
&lt;td&gt;
0.987794
&lt;/td&gt;
&lt;td&gt;
0.487229
&lt;/td&gt;
&lt;td&gt;
2.859248
&lt;/td&gt;
&lt;td&gt;
0.583304
&lt;/td&gt;
&lt;td&gt;
0.295531
&lt;/td&gt;
&lt;td&gt;
22.247504
&lt;/td&gt;
&lt;td&gt;
2.280621
&lt;/td&gt;
&lt;td&gt;
0.103127
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;std&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.480032
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.930231
&lt;/td&gt;
&lt;td&gt;
640.824117
&lt;/td&gt;
&lt;td&gt;
5.685594
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
65.213049
&lt;/td&gt;
&lt;td&gt;
70.197445
&lt;/td&gt;
&lt;td&gt;
0.540651
&lt;/td&gt;
&lt;td&gt;
14.674414
&lt;/td&gt;
&lt;td&gt;
1.242828
&lt;/td&gt;
&lt;td&gt;
0.101155
&lt;/td&gt;
&lt;td&gt;
3.374169
&lt;/td&gt;
&lt;td&gt;
2.111966
&lt;/td&gt;
&lt;td&gt;
0.051038
&lt;/td&gt;
&lt;td&gt;
18.368208
&lt;/td&gt;
&lt;td&gt;
0.757839
&lt;/td&gt;
&lt;td&gt;
0.347973
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;min&amp;quot;
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-09-30 14:06:36.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-09-30 14:23:04.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-1294.5
&lt;/td&gt;
&lt;td&gt;
-22.18
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-100.01
&lt;/td&gt;
&lt;td&gt;
-70.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-1301.85
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
-1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;max&amp;quot;
&lt;/td&gt;
&lt;td&gt;
6.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-11-01 01:27:35.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-11-03 17:26:46.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
9.0
&lt;/td&gt;
&lt;td&gt;
389678.46
&lt;/td&gt;
&lt;td&gt;
99.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Y&amp;quot;
&lt;/td&gt;
&lt;td&gt;
265.0
&lt;/td&gt;
&lt;td&gt;
265.0
&lt;/td&gt;
&lt;td&gt;
4.0
&lt;/td&gt;
&lt;td&gt;
1294.5
&lt;/td&gt;
&lt;td&gt;
10.8
&lt;/td&gt;
&lt;td&gt;
25.48
&lt;/td&gt;
&lt;td&gt;
500.0
&lt;/td&gt;
&lt;td&gt;
516.75
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1301.85
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;median&amp;quot;
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.9
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
162.0
&lt;/td&gt;
&lt;td&gt;
162.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
10.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.22
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
16.55
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;My &lt;code&gt;min tpep_pickup_datetime&lt;/code&gt; is still &lt;code&gt;2022-09-30&lt;/code&gt; (I was expecting 2020). What's going on? Maybe our data is only for Octover 2022 after all, and the 2008 date I was seeing was spurious? Note that we had 3675411 data points before we filtered by date and now we have 3675407 data points (I'm getting this by looking at the &lt;code&gt;count&lt;/code&gt; field for &lt;code&gt;tpep_pickup_datetime&lt;/code&gt;). Our date filtering only got rid of 4 data points. So we're looking only at October 2022 data with a couple of spurious data points thrown in.&lt;/p&gt;
&lt;p&gt;I'm curious what the data with bad dates look like.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&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;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;tpep_pickup_datetime&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;)&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;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (4, 19)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
VendorID
&lt;/th&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
tpep_dropoff_datetime
&lt;/th&gt;
&lt;th&gt;
passenger_count
&lt;/th&gt;
&lt;th&gt;
trip_distance
&lt;/th&gt;
&lt;th&gt;
RatecodeID
&lt;/th&gt;
&lt;th&gt;
store_and_fwd_flag
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
payment_type
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;th&gt;
extra
&lt;/th&gt;
&lt;th&gt;
mta_tax
&lt;/th&gt;
&lt;th&gt;
tip_amount
&lt;/th&gt;
&lt;th&gt;
tolls_amount
&lt;/th&gt;
&lt;th&gt;
improvement_surcharge
&lt;/th&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
congestion_surcharge
&lt;/th&gt;
&lt;th&gt;
airport_fee
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2009-01-01 01:57:50
&lt;/td&gt;
&lt;td&gt;
2009-01-01 02:20:59
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
7.84
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
161
&lt;/td&gt;
&lt;td&gt;
264
&lt;/td&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
22.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
23.3
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2008-12-31 23:02:01
&lt;/td&gt;
&lt;td&gt;
2009-01-01 19:08:45
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
22.93
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
132
&lt;/td&gt;
&lt;td&gt;
25
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
63.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
13.01
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
78.06
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2008-12-31 23:02:02
&lt;/td&gt;
&lt;td&gt;
2009-01-01 20:14:39
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
231
&lt;/td&gt;
&lt;td&gt;
231
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
52.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
10.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
66.55
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2009-01-01 00:02:31
&lt;/td&gt;
&lt;td&gt;
2009-01-01 17:02:49
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
8.11
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
186
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
35.5
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
9.52
&lt;/td&gt;
&lt;td&gt;
6.55
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
57.12
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2&gt;Finding bad pairs&lt;/h2&gt;
&lt;p&gt;I don't see any obvious ways to correlate the bad pairs - the rows don't have IDs, there is no cab ID, and the payment method field doesn't give us much either. We'll have to data science.&lt;/p&gt;
&lt;p&gt;Let's try this:
- Find negative data points
- For each negative data point, find a data point with the same amount but positive that also matches other parameters such as date and pick up / drop off location&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&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;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;fare_amount&amp;quot;&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;0&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;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (25899, 19)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
VendorID
&lt;/th&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
tpep_dropoff_datetime
&lt;/th&gt;
&lt;th&gt;
passenger_count
&lt;/th&gt;
&lt;th&gt;
trip_distance
&lt;/th&gt;
&lt;th&gt;
RatecodeID
&lt;/th&gt;
&lt;th&gt;
store_and_fwd_flag
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
payment_type
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;th&gt;
extra
&lt;/th&gt;
&lt;th&gt;
mta_tax
&lt;/th&gt;
&lt;th&gt;
tip_amount
&lt;/th&gt;
&lt;th&gt;
tolls_amount
&lt;/th&gt;
&lt;th&gt;
improvement_surcharge
&lt;/th&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
congestion_surcharge
&lt;/th&gt;
&lt;th&gt;
airport_fee
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:52:07
&lt;/td&gt;
&lt;td&gt;
2022-10-01 01:02:44
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
2.83
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
141
&lt;/td&gt;
&lt;td&gt;
79
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
-10.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-14.3
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:29:57
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:34:37
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.31
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
264
&lt;/td&gt;
&lt;td&gt;
264
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
-4.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-8.3
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:31:37
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:32:53
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.31
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
-3.0
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-5.55
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:46:38
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:46:44
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
249
&lt;/td&gt;
&lt;td&gt;
249
&lt;/td&gt;
&lt;td&gt;
3
&lt;/td&gt;
&lt;td&gt;
-52.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-55.3
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:06:08
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:48:23
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
17.05
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
175
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
-50.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-6.55
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-60.85
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:40:58
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:56:33
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
2.7
&lt;/td&gt;
&lt;td&gt;
5.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
148
&lt;/td&gt;
&lt;td&gt;
90
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
-27.31
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-30.61
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:43:19
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:44:02
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.02
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
90
&lt;/td&gt;
&lt;td&gt;
90
&lt;/td&gt;
&lt;td&gt;
3
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-6.3
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:12:32
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:12:51
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
48
&lt;/td&gt;
&lt;td&gt;
48
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-6.3
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:12:24
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:13:06
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.33
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
-3.0
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-5.55
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:39:21
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:40:07
&lt;/td&gt;
&lt;td&gt;
4.0
&lt;/td&gt;
&lt;td&gt;
0.15
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
230
&lt;/td&gt;
&lt;td&gt;
230
&lt;/td&gt;
&lt;td&gt;
3
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-6.3
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:08:25
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:21:22
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
1.46
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
79
&lt;/td&gt;
&lt;td&gt;
211
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
-9.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-13.3
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:45:01
&lt;/td&gt;
&lt;td&gt;
2022-10-01 01:18:01
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
2.35
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
79
&lt;/td&gt;
&lt;td&gt;
249
&lt;/td&gt;
&lt;td&gt;
4
&lt;/td&gt;
&lt;td&gt;
-13.0
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-16.8
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-06 16:17:49
&lt;/td&gt;
&lt;td&gt;
2022-10-06 16:20:42
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.28
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
79
&lt;/td&gt;
&lt;td&gt;
107
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
-95.68
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
15.22
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
-77.16
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-10 12:27:10
&lt;/td&gt;
&lt;td&gt;
2022-10-10 12:56:00
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
60043.58
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
125
&lt;/td&gt;
&lt;td&gt;
68
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
-17.28
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
-4.49
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
-24.77
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-13 21:55:30
&lt;/td&gt;
&lt;td&gt;
2022-10-13 21:56:26
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.03
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
144
&lt;/td&gt;
&lt;td&gt;
144
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
-27.33
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
3.69
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
-20.34
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-13 22:44:00
&lt;/td&gt;
&lt;td&gt;
2022-10-13 22:45:00
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.03
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
90
&lt;/td&gt;
&lt;td&gt;
90
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
-38.85
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
6.62
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
-28.93
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-14 03:26:00
&lt;/td&gt;
&lt;td&gt;
2022-10-14 03:27:00
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.04
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
114
&lt;/td&gt;
&lt;td&gt;
114
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
-26.79
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
-23.49
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-16 04:52:00
&lt;/td&gt;
&lt;td&gt;
2022-10-16 05:01:00
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
2.71
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
233
&lt;/td&gt;
&lt;td&gt;
262
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
-61.61
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
5.9
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
-52.41
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-18 13:06:39
&lt;/td&gt;
&lt;td&gt;
2022-10-18 13:06:52
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
232
&lt;/td&gt;
&lt;td&gt;
232
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
-0.8
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-19 01:55:00
&lt;/td&gt;
&lt;td&gt;
2022-10-19 01:56:00
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.06
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
237
&lt;/td&gt;
&lt;td&gt;
237
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
-22.39
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.92
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
-16.17
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-22 19:35:59
&lt;/td&gt;
&lt;td&gt;
2022-10-22 19:36:03
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
239
&lt;/td&gt;
&lt;td&gt;
239
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
-0.8
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-25 07:40:00
&lt;/td&gt;
&lt;td&gt;
2022-10-25 07:42:00
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.07
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
140
&lt;/td&gt;
&lt;td&gt;
140
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
-54.25
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
7.29
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
-43.66
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-28 09:13:07
&lt;/td&gt;
&lt;td&gt;
2022-10-28 09:13:26
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
141
&lt;/td&gt;
&lt;td&gt;
141
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
-0.8
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-29 07:33:24
&lt;/td&gt;
&lt;td&gt;
2022-10-29 07:37:01
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
37
&lt;/td&gt;
&lt;td&gt;
37
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
-18.55
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.72
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
-15.03
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;There's probably a clever way to do this, but my initial thought for getting rid of the corresponding positives is to create a new dataframe with the negative rows, then do an anti-join back to the original dataframe. An anti-join should find matching rows and remove them.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;negative_data&lt;/span&gt; &lt;span class="o"&gt;=&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;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;fare_amount&amp;quot;&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;0&lt;/span&gt;&lt;span class="p"&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;select&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;tpep_pickup_datetime&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;PULocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;fare_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;negative_data&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (25899, 3)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:52:07
&lt;/td&gt;
&lt;td&gt;
141
&lt;/td&gt;
&lt;td&gt;
-10.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:29:57
&lt;/td&gt;
&lt;td&gt;
264
&lt;/td&gt;
&lt;td&gt;
-4.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:31:37
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
-3.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:46:38
&lt;/td&gt;
&lt;td&gt;
249
&lt;/td&gt;
&lt;td&gt;
-52.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:06:08
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
-50.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:40:58
&lt;/td&gt;
&lt;td&gt;
148
&lt;/td&gt;
&lt;td&gt;
-27.31
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:43:19
&lt;/td&gt;
&lt;td&gt;
90
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:12:32
&lt;/td&gt;
&lt;td&gt;
48
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:12:24
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
-3.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:39:21
&lt;/td&gt;
&lt;td&gt;
230
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:08:25
&lt;/td&gt;
&lt;td&gt;
79
&lt;/td&gt;
&lt;td&gt;
-9.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:45:01
&lt;/td&gt;
&lt;td&gt;
79
&lt;/td&gt;
&lt;td&gt;
-13.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-06 16:17:49
&lt;/td&gt;
&lt;td&gt;
79
&lt;/td&gt;
&lt;td&gt;
-95.68
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-10 12:27:10
&lt;/td&gt;
&lt;td&gt;
125
&lt;/td&gt;
&lt;td&gt;
-17.28
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-13 21:55:30
&lt;/td&gt;
&lt;td&gt;
144
&lt;/td&gt;
&lt;td&gt;
-27.33
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-13 22:44:00
&lt;/td&gt;
&lt;td&gt;
90
&lt;/td&gt;
&lt;td&gt;
-38.85
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-14 03:26:00
&lt;/td&gt;
&lt;td&gt;
114
&lt;/td&gt;
&lt;td&gt;
-26.79
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-16 04:52:00
&lt;/td&gt;
&lt;td&gt;
233
&lt;/td&gt;
&lt;td&gt;
-61.61
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-18 13:06:39
&lt;/td&gt;
&lt;td&gt;
232
&lt;/td&gt;
&lt;td&gt;
-0.8
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-19 01:55:00
&lt;/td&gt;
&lt;td&gt;
237
&lt;/td&gt;
&lt;td&gt;
-22.39
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-22 19:35:59
&lt;/td&gt;
&lt;td&gt;
239
&lt;/td&gt;
&lt;td&gt;
-0.8
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-25 07:40:00
&lt;/td&gt;
&lt;td&gt;
140
&lt;/td&gt;
&lt;td&gt;
-54.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-28 09:13:07
&lt;/td&gt;
&lt;td&gt;
141
&lt;/td&gt;
&lt;td&gt;
-0.8
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-29 07:33:24
&lt;/td&gt;
&lt;td&gt;
37
&lt;/td&gt;
&lt;td&gt;
-18.55
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;I'm only grabbing a few columns for my negative_data dataframe, since all I'm going to use it for is to remove the corresponding positive rows from the original data. I'll try matching on the pick up date and pick up location.&lt;/p&gt;
&lt;p&gt;Let's convert the negative amounts to positive so we can directly match them to their corresponding positive rows in the original data.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;negative_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;negative_data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;with_columns&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;fare_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&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="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;amount_positive&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;negative_data&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (25899, 4)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;th&gt;
amount_positive
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:52:07
&lt;/td&gt;
&lt;td&gt;
141
&lt;/td&gt;
&lt;td&gt;
-10.5
&lt;/td&gt;
&lt;td&gt;
10.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:29:57
&lt;/td&gt;
&lt;td&gt;
264
&lt;/td&gt;
&lt;td&gt;
-4.5
&lt;/td&gt;
&lt;td&gt;
4.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:31:37
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
-3.0
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:46:38
&lt;/td&gt;
&lt;td&gt;
249
&lt;/td&gt;
&lt;td&gt;
-52.0
&lt;/td&gt;
&lt;td&gt;
52.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:06:08
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
-50.5
&lt;/td&gt;
&lt;td&gt;
50.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:40:58
&lt;/td&gt;
&lt;td&gt;
148
&lt;/td&gt;
&lt;td&gt;
-27.31
&lt;/td&gt;
&lt;td&gt;
27.31
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:43:19
&lt;/td&gt;
&lt;td&gt;
90
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:12:32
&lt;/td&gt;
&lt;td&gt;
48
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:12:24
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
-3.0
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:39:21
&lt;/td&gt;
&lt;td&gt;
230
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:08:25
&lt;/td&gt;
&lt;td&gt;
79
&lt;/td&gt;
&lt;td&gt;
-9.5
&lt;/td&gt;
&lt;td&gt;
9.5
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-01 00:45:01
&lt;/td&gt;
&lt;td&gt;
79
&lt;/td&gt;
&lt;td&gt;
-13.0
&lt;/td&gt;
&lt;td&gt;
13.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-06 16:17:49
&lt;/td&gt;
&lt;td&gt;
79
&lt;/td&gt;
&lt;td&gt;
-95.68
&lt;/td&gt;
&lt;td&gt;
95.68
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-10 12:27:10
&lt;/td&gt;
&lt;td&gt;
125
&lt;/td&gt;
&lt;td&gt;
-17.28
&lt;/td&gt;
&lt;td&gt;
17.28
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-13 21:55:30
&lt;/td&gt;
&lt;td&gt;
144
&lt;/td&gt;
&lt;td&gt;
-27.33
&lt;/td&gt;
&lt;td&gt;
27.33
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-13 22:44:00
&lt;/td&gt;
&lt;td&gt;
90
&lt;/td&gt;
&lt;td&gt;
-38.85
&lt;/td&gt;
&lt;td&gt;
38.85
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-14 03:26:00
&lt;/td&gt;
&lt;td&gt;
114
&lt;/td&gt;
&lt;td&gt;
-26.79
&lt;/td&gt;
&lt;td&gt;
26.79
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-16 04:52:00
&lt;/td&gt;
&lt;td&gt;
233
&lt;/td&gt;
&lt;td&gt;
-61.61
&lt;/td&gt;
&lt;td&gt;
61.61
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-18 13:06:39
&lt;/td&gt;
&lt;td&gt;
232
&lt;/td&gt;
&lt;td&gt;
-0.8
&lt;/td&gt;
&lt;td&gt;
0.8
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-19 01:55:00
&lt;/td&gt;
&lt;td&gt;
237
&lt;/td&gt;
&lt;td&gt;
-22.39
&lt;/td&gt;
&lt;td&gt;
22.39
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-22 19:35:59
&lt;/td&gt;
&lt;td&gt;
239
&lt;/td&gt;
&lt;td&gt;
-0.8
&lt;/td&gt;
&lt;td&gt;
0.8
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-25 07:40:00
&lt;/td&gt;
&lt;td&gt;
140
&lt;/td&gt;
&lt;td&gt;
-54.25
&lt;/td&gt;
&lt;td&gt;
54.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-28 09:13:07
&lt;/td&gt;
&lt;td&gt;
141
&lt;/td&gt;
&lt;td&gt;
-0.8
&lt;/td&gt;
&lt;td&gt;
0.8
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2022-10-29 07:33:24
&lt;/td&gt;
&lt;td&gt;
37
&lt;/td&gt;
&lt;td&gt;
-18.55
&lt;/td&gt;
&lt;td&gt;
18.55
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Now that we have a dataframe with the negative amounts converted to positive, we can join back to the original data, matching on the (now positive) fare amount and the pick up location. We'll do an anti-join, which gets rids of the rows that match. If Polars didn't have anti-join as an option we could have merged the new dataframe with the original data and dropped duplicate rows.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;negative_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;PULocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;fare_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;how&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;anti&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (3649512, 19)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
VendorID
&lt;/th&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
tpep_dropoff_datetime
&lt;/th&gt;
&lt;th&gt;
passenger_count
&lt;/th&gt;
&lt;th&gt;
trip_distance
&lt;/th&gt;
&lt;th&gt;
RatecodeID
&lt;/th&gt;
&lt;th&gt;
store_and_fwd_flag
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
payment_type
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;th&gt;
extra
&lt;/th&gt;
&lt;th&gt;
mta_tax
&lt;/th&gt;
&lt;th&gt;
tip_amount
&lt;/th&gt;
&lt;th&gt;
tolls_amount
&lt;/th&gt;
&lt;th&gt;
improvement_surcharge
&lt;/th&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
congestion_surcharge
&lt;/th&gt;
&lt;th&gt;
airport_fee
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:03:41
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:18:39
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.7
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
249
&lt;/td&gt;
&lt;td&gt;
107
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
9.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.65
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
15.95
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:14:30
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:19:48
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
0.72
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
151
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
5.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
9.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:27:13
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:37:41
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.74
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
166
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
9.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.06
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
12.36
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:32:53
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:38:55
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.3
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
142
&lt;/td&gt;
&lt;td&gt;
239
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
6.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.05
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
12.35
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:44:55
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:50:21
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
166
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
6.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
1.8
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
9.1
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:22:52
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:52:14
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
6.8
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Y&amp;quot;
&lt;/td&gt;
&lt;td&gt;
186
&lt;/td&gt;
&lt;td&gt;
41
&lt;/td&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
25.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
29.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:33:19
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:44:51
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
1.88
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
162
&lt;/td&gt;
&lt;td&gt;
145
&lt;/td&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
10.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
14.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:02:42
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:50:01
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
12.2
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
100
&lt;/td&gt;
&lt;td&gt;
22
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
41.0
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
47.8
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:06:35
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:24:38
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
7.79
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
112
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
23.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
4.96
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
31.01
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:29:25
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:43:15
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
4.72
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
145
&lt;/td&gt;
&lt;td&gt;
75
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
14.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
1.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
19.8
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:01:55
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:20:16
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
8.8
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
236
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
26.0
&lt;/td&gt;
&lt;td&gt;
4.25
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
5.64
&lt;/td&gt;
&lt;td&gt;
6.55
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
43.24
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:27:48
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:59:50
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
8.6
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
140
&lt;/td&gt;
&lt;td&gt;
36
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
29.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
6.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
39.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:30:42
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:40:16
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
1.7
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
158
&lt;/td&gt;
&lt;td&gt;
90
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
9.95
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.93
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
16.18
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:42:05
&lt;/td&gt;
&lt;td&gt;
2022-11-01 00:13:58
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
17.5
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
132
&lt;/td&gt;
&lt;td&gt;
68
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
52.0
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
9.46
&lt;/td&gt;
&lt;td&gt;
6.55
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
72.56
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:52:34
&lt;/td&gt;
&lt;td&gt;
2022-11-01 00:23:32
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
12.6
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
116
&lt;/td&gt;
&lt;td&gt;
37
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
40.67
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
5.26
&lt;/td&gt;
&lt;td&gt;
6.55
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
53.28
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:16:12
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:32:36
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
6.23
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
158
&lt;/td&gt;
&lt;td&gt;
166
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
22.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
5.67
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
31.47
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:15:00
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:20:00
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.72
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
142
&lt;/td&gt;
&lt;td&gt;
142
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
9.95
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.92
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
16.17
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:20:21
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:34:15
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
2.7
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
163
&lt;/td&gt;
&lt;td&gt;
68
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
12.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
3.95
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
19.75
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:45:37
&lt;/td&gt;
&lt;td&gt;
2022-11-01 00:00:39
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
2.45
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
249
&lt;/td&gt;
&lt;td&gt;
162
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
11.97
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
3.39
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
18.66
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:56:35
&lt;/td&gt;
&lt;td&gt;
2022-11-01 00:10:11
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
2.25
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
137
&lt;/td&gt;
&lt;td&gt;
50
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
12.68
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
3.16
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
19.14
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:22:00
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:28:00
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
1.22
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
142
&lt;/td&gt;
&lt;td&gt;
161
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
10.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
14.3
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:25:00
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:48:00
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
4.7
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
186
&lt;/td&gt;
&lt;td&gt;
45
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
19.07
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
4.97
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
27.34
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:32:54
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:33:02
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
264
&lt;/td&gt;
&lt;td&gt;
263
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
16.82
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
4.58
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
22.2
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:21:34
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:32:42
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
166
&lt;/td&gt;
&lt;td&gt;
116
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
8.93
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
9.73
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Did that work? Let's see how many rows that got rid of.
After the anti-join we end up with 3649512 rows. We had and 25899 rows with negative values.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;n_rows_original&lt;/span&gt; &lt;span class="o"&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;shape&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="n"&gt;n_rows_negative&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;negative_data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&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="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;We are expecting &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;n_rows_original&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;n_rows_negative&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; rows if our removal worked perfectly&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nv"&gt;We&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;are&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;expecting&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3649512&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;rows&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;our&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;removal&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;worked&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;perfectly&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Sure enough the result of the anti-join has 3649512 rows (you can see that from the shape output a few cells above), so our method is working well. We should sanity check to make sure it's working as expected, but for now let's assume all is well.&lt;/p&gt;
&lt;p&gt;We can now do our final cleaning: we'll get rid of the negative and corresponding positive rows, get rid of anything where the mileage is over 3000 miles, remove dates that are out of range, and get rid of rows with unknown pick up and drop off locations:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;clean_data&lt;/span&gt; &lt;span class="o"&gt;=&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;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;negative_data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;PULocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;fare_amount&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;how&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;anti&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;fare_amount&amp;quot;&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;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;trip_distance&amp;quot;&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;3000&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;tpep_pickup_datetime&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;start_date&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; 
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;PULocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;265&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;pl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;DOLocationID&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;265&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;clean_data&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (3630123, 19)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
VendorID
&lt;/th&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
tpep_dropoff_datetime
&lt;/th&gt;
&lt;th&gt;
passenger_count
&lt;/th&gt;
&lt;th&gt;
trip_distance
&lt;/th&gt;
&lt;th&gt;
RatecodeID
&lt;/th&gt;
&lt;th&gt;
store_and_fwd_flag
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
payment_type
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;th&gt;
extra
&lt;/th&gt;
&lt;th&gt;
mta_tax
&lt;/th&gt;
&lt;th&gt;
tip_amount
&lt;/th&gt;
&lt;th&gt;
tolls_amount
&lt;/th&gt;
&lt;th&gt;
improvement_surcharge
&lt;/th&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
congestion_surcharge
&lt;/th&gt;
&lt;th&gt;
airport_fee
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
datetime[ns]
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
i64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:03:41
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:18:39
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.7
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
249
&lt;/td&gt;
&lt;td&gt;
107
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
9.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.65
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
15.95
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:14:30
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:19:48
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
0.72
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
151
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
5.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
9.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:27:13
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:37:41
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.74
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
166
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
9.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.06
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
12.36
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:32:53
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:38:55
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.3
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
142
&lt;/td&gt;
&lt;td&gt;
239
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
6.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.05
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
12.35
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:44:55
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:50:21
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
238
&lt;/td&gt;
&lt;td&gt;
166
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
6.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
1.8
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
9.1
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:22:52
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:52:14
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
6.8
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Y&amp;quot;
&lt;/td&gt;
&lt;td&gt;
186
&lt;/td&gt;
&lt;td&gt;
41
&lt;/td&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
25.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
29.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:33:19
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:44:51
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
1.88
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
162
&lt;/td&gt;
&lt;td&gt;
145
&lt;/td&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
10.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
14.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:02:42
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:50:01
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
12.2
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
100
&lt;/td&gt;
&lt;td&gt;
22
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
41.0
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
47.8
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:06:35
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:24:38
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
7.79
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
112
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
23.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
4.96
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
31.01
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:29:25
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:43:15
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
4.72
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
145
&lt;/td&gt;
&lt;td&gt;
75
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
14.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
1.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
19.8
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:01:55
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:20:16
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
8.8
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
138
&lt;/td&gt;
&lt;td&gt;
236
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
26.0
&lt;/td&gt;
&lt;td&gt;
4.25
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
5.64
&lt;/td&gt;
&lt;td&gt;
6.55
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
43.24
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:27:48
&lt;/td&gt;
&lt;td&gt;
2022-10-01 00:59:50
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
8.6
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
140
&lt;/td&gt;
&lt;td&gt;
36
&lt;/td&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
29.5
&lt;/td&gt;
&lt;td&gt;
3.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
6.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
39.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;td&gt;
...
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:30:42
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:40:16
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
1.7
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
158
&lt;/td&gt;
&lt;td&gt;
90
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
9.95
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.93
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
16.18
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:42:05
&lt;/td&gt;
&lt;td&gt;
2022-11-01 00:13:58
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
17.5
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
132
&lt;/td&gt;
&lt;td&gt;
68
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
52.0
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
9.46
&lt;/td&gt;
&lt;td&gt;
6.55
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
72.56
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:52:34
&lt;/td&gt;
&lt;td&gt;
2022-11-01 00:23:32
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
12.6
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
116
&lt;/td&gt;
&lt;td&gt;
37
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
40.67
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
5.26
&lt;/td&gt;
&lt;td&gt;
6.55
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
53.28
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:16:12
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:32:36
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
6.23
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
158
&lt;/td&gt;
&lt;td&gt;
166
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
22.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
5.67
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
31.47
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:15:00
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:20:00
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.72
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
142
&lt;/td&gt;
&lt;td&gt;
142
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
9.95
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.92
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
16.17
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:20:21
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:34:15
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
2.7
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
163
&lt;/td&gt;
&lt;td&gt;
68
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
12.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
3.95
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
19.75
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:45:37
&lt;/td&gt;
&lt;td&gt;
2022-11-01 00:00:39
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
2.45
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
249
&lt;/td&gt;
&lt;td&gt;
162
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
11.97
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
3.39
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
18.66
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:56:35
&lt;/td&gt;
&lt;td&gt;
2022-11-01 00:10:11
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
2.25
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
137
&lt;/td&gt;
&lt;td&gt;
50
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
12.68
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
3.16
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
19.14
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:22:00
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:28:00
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
1.22
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
142
&lt;/td&gt;
&lt;td&gt;
161
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
10.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
14.3
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:25:00
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:48:00
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
4.7
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
186
&lt;/td&gt;
&lt;td&gt;
45
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
19.07
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
4.97
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
27.34
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
2
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:32:54
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:33:02
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
264
&lt;/td&gt;
&lt;td&gt;
263
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
16.82
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
4.58
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
22.2
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
1
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:21:34
&lt;/td&gt;
&lt;td&gt;
2022-10-31 23:32:42
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
166
&lt;/td&gt;
&lt;td&gt;
116
&lt;/td&gt;
&lt;td&gt;
0
&lt;/td&gt;
&lt;td&gt;
8.93
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
9.73
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;How many rows of data did we get rid of?&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&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="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;clean_data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;45288&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;clean_data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }

    .dataframe td {
        white-space: pre;
    }

    .dataframe td {
        padding-top: 0;
    }

    .dataframe td {
        padding-bottom: 0;
    }

    .dataframe td {
        line-height: 95%;
    }
&lt;/style&gt;
&lt;table border="1" class="dataframe"&gt;
&lt;small&gt;shape: (7, 20)&lt;/small&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
describe
&lt;/th&gt;
&lt;th&gt;
VendorID
&lt;/th&gt;
&lt;th&gt;
tpep_pickup_datetime
&lt;/th&gt;
&lt;th&gt;
tpep_dropoff_datetime
&lt;/th&gt;
&lt;th&gt;
passenger_count
&lt;/th&gt;
&lt;th&gt;
trip_distance
&lt;/th&gt;
&lt;th&gt;
RatecodeID
&lt;/th&gt;
&lt;th&gt;
store_and_fwd_flag
&lt;/th&gt;
&lt;th&gt;
PULocationID
&lt;/th&gt;
&lt;th&gt;
DOLocationID
&lt;/th&gt;
&lt;th&gt;
payment_type
&lt;/th&gt;
&lt;th&gt;
fare_amount
&lt;/th&gt;
&lt;th&gt;
extra
&lt;/th&gt;
&lt;th&gt;
mta_tax
&lt;/th&gt;
&lt;th&gt;
tip_amount
&lt;/th&gt;
&lt;th&gt;
tolls_amount
&lt;/th&gt;
&lt;th&gt;
improvement_surcharge
&lt;/th&gt;
&lt;th&gt;
total_amount
&lt;/th&gt;
&lt;th&gt;
congestion_surcharge
&lt;/th&gt;
&lt;th&gt;
airport_fee
&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
str
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;td&gt;
f64
&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;count&amp;quot;
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
&amp;quot;3630123&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;3630123&amp;quot;
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
&amp;quot;3630123&amp;quot;
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;td&gt;
3.630123e6
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;null_count&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;0&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;0&amp;quot;
&lt;/td&gt;
&lt;td&gt;
126893.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
126893.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;126893&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
126893.0
&lt;/td&gt;
&lt;td&gt;
126893.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;mean&amp;quot;
&lt;/td&gt;
&lt;td&gt;
1.712003
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
1.384814
&lt;/td&gt;
&lt;td&gt;
3.554337
&lt;/td&gt;
&lt;td&gt;
1.413354
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
165.373444
&lt;/td&gt;
&lt;td&gt;
162.575655
&lt;/td&gt;
&lt;td&gt;
1.174523
&lt;/td&gt;
&lt;td&gt;
15.200393
&lt;/td&gt;
&lt;td&gt;
1.001434
&lt;/td&gt;
&lt;td&gt;
0.494995
&lt;/td&gt;
&lt;td&gt;
2.854254
&lt;/td&gt;
&lt;td&gt;
0.571016
&lt;/td&gt;
&lt;td&gt;
0.299767
&lt;/td&gt;
&lt;td&gt;
22.190213
&lt;/td&gt;
&lt;td&gt;
2.319343
&lt;/td&gt;
&lt;td&gt;
0.103112
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;std&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.45283
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
0.931426
&lt;/td&gt;
&lt;td&gt;
4.456602
&lt;/td&gt;
&lt;td&gt;
5.684473
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
65.14861
&lt;/td&gt;
&lt;td&gt;
70.034565
&lt;/td&gt;
&lt;td&gt;
0.504213
&lt;/td&gt;
&lt;td&gt;
13.14293
&lt;/td&gt;
&lt;td&gt;
1.242161
&lt;/td&gt;
&lt;td&gt;
0.0556
&lt;/td&gt;
&lt;td&gt;
3.227445
&lt;/td&gt;
&lt;td&gt;
2.036301
&lt;/td&gt;
&lt;td&gt;
0.009334
&lt;/td&gt;
&lt;td&gt;
16.768073
&lt;/td&gt;
&lt;td&gt;
0.648033
&lt;/td&gt;
&lt;td&gt;
0.343979
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;min&amp;quot;
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-09-30 14:06:36.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-09-30 14:23:04.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;N&amp;quot;
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-22.18
&lt;/td&gt;
&lt;td&gt;
-0.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
-0.3
&lt;/td&gt;
&lt;td&gt;
-4.55
&lt;/td&gt;
&lt;td&gt;
-2.5
&lt;/td&gt;
&lt;td&gt;
-1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;max&amp;quot;
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-11-01 01:27:35.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
&amp;quot;2022-11-03 17:26:46.000000000&amp;quot;
&lt;/td&gt;
&lt;td&gt;
9.0
&lt;/td&gt;
&lt;td&gt;
462.86
&lt;/td&gt;
&lt;td&gt;
99.0
&lt;/td&gt;
&lt;td&gt;
&amp;quot;Y&amp;quot;
&lt;/td&gt;
&lt;td&gt;
264.0
&lt;/td&gt;
&lt;td&gt;
264.0
&lt;/td&gt;
&lt;td&gt;
4.0
&lt;/td&gt;
&lt;td&gt;
950.0
&lt;/td&gt;
&lt;td&gt;
10.8
&lt;/td&gt;
&lt;td&gt;
25.48
&lt;/td&gt;
&lt;td&gt;
500.0
&lt;/td&gt;
&lt;td&gt;
516.75
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
950.3
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
1.25
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&amp;quot;median&amp;quot;
&lt;/td&gt;
&lt;td&gt;
2.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
1.9
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
null
&lt;/td&gt;
&lt;td&gt;
162.0
&lt;/td&gt;
&lt;td&gt;
162.0
&lt;/td&gt;
&lt;td&gt;
1.0
&lt;/td&gt;
&lt;td&gt;
10.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
0.5
&lt;/td&gt;
&lt;td&gt;
2.25
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;td&gt;
0.3
&lt;/td&gt;
&lt;td&gt;
16.55
&lt;/td&gt;
&lt;td&gt;
2.5
&lt;/td&gt;
&lt;td&gt;
0.0
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;That's looking better - we still have some negatives and other strange looking things, but you get a sense of how we'd approach getting rid of those. For next steps I'd probably filter more things that look incorrect, then I'd plot the data as a histogram and eyeball it to see if there's anything strange in there.&lt;/p&gt;
&lt;p&gt;Let's stop there.&lt;/p&gt;
&lt;p&gt;This was my first foray into Polars, so it's likely there are more polarsy ways of doing things - if you know of improvements please let me know.&lt;/p&gt;
&lt;p&gt;Overall I really like Polars. It's fast and clean and the resulting code is easy on the eyes. I'm likely to use it in place of Pandas going forward.&lt;/p&gt;
&lt;h2&gt;Links&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://kevinheavey.github.io/modern-polars/"&gt;Modern Polars&lt;/a&gt; is quite nice with many examples.&lt;/p&gt;
&lt;p&gt;Towards Data Science has a good article called &lt;a href="https://towardsdatascience.com/pandas-dataframe-but-much-faster-f475d6be4cd4"&gt;Polars: Pandas DataFrame but Much Faster&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.codemag.com/Article/2212051/Using-the-Polars-DataFrame-Library"&gt;This article from Code Magazine&lt;/a&gt; has a lot of good Polars examples.&lt;/p&gt;
&lt;p&gt;The Polars documentation page on &lt;a href="https://pola-rs.github.io/polars-book/user-guide/coming_from_pandas.html"&gt;Coming from Pandas&lt;/a&gt; is very useful if you have Pandas experience.&lt;/p&gt;
&lt;p&gt;While we're at it, read &lt;a href="https://kentnerburn.com/the-cab-ride-ill-never-forget/"&gt;this piece from a former cab driver on the ride he'll never forget&lt;/a&gt;.&lt;/p&gt;</content><category term="Technical"/><category term="technical"/><category term="python"/></entry><entry><title>Blog Technical Setup</title><link href="https://www.parand.com/blog-technical-setup.html" rel="alternate"/><published>2023-02-16T23:33:00-08:00</published><updated>2023-02-16T23:33:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2023-02-16:/blog-technical-setup.html</id><summary type="html">&lt;h1&gt;Overview&lt;/h1&gt;
&lt;p&gt;I'm using &lt;a href="https://github.com/getpelican/pelican"&gt;Pelican&lt;/a&gt; as the static website creation framework.&lt;/p&gt;
&lt;p&gt;I created the theme myself, I can open sores it if anyone is interested. It uses tailwind, which is mostly quite good, but a pain when it comes to 
integration with Pelican: tailwind wants classes added to html, but the …&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Overview&lt;/h1&gt;
&lt;p&gt;I'm using &lt;a href="https://github.com/getpelican/pelican"&gt;Pelican&lt;/a&gt; as the static website creation framework.&lt;/p&gt;
&lt;p&gt;I created the theme myself, I can open sores it if anyone is interested. It uses tailwind, which is mostly quite good, but a pain when it comes to 
integration with Pelican: tailwind wants classes added to html, but the html is generated (as opposed to hand-written), so it's hard to style.&lt;/p&gt;
&lt;p&gt;The website is being served via github pages.&lt;/p&gt;
&lt;p&gt;I wrote a custom script to create redirects from the old wordpress style URLs to the URLs.&lt;/p&gt;
&lt;p&gt;Authoring: I write in markdown, run Pelican to generate the html, commit the output in git, push to github, and the website is updated. Fairly clunky, I'd like to make that smoother.&lt;/p&gt;</content><category term="Technical"/><category term="how-to"/></entry><entry><title>Everything Sad is Untrue: Book Review</title><link href="https://www.parand.com/everything-sad-is-untrue.html" rel="alternate"/><published>2022-12-26T23:38:00-08:00</published><updated>2022-12-26T23:38:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2022-12-26:/everything-sad-is-untrue.html</id><content type="html">&lt;p&gt;Author: Daniel Nayeri&lt;/p&gt;
&lt;p&gt;Quite good, nostalgic, I immediately decided to look for other books by the author.&lt;/p&gt;</content><category term="Book Review"/><category term="review"/><category term="book"/><category term="read-it"/></entry><entry><title>Parable of the Sower: Book Review</title><link href="https://www.parand.com/parable-of-the-sower.html" rel="alternate"/><published>2022-12-26T23:38:00-08:00</published><updated>2022-12-26T23:38:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2022-12-26:/parable-of-the-sower.html</id><content type="html">&lt;p&gt;Post-apocalyptic non-sci-fi book. Entertaining, not a bad read, not amazing. Verdict: Maybe Read It&lt;/p&gt;</content><category term="Book Review"/><category term="review"/><category term="book"/><category term="maybe-read-it"/></entry><entry><title>Banshees of Inisherin: Review</title><link href="https://www.parand.com/banshees-of-inisherin.html" rel="alternate"/><published>2022-12-26T23:33:00-08:00</published><updated>2022-12-26T23:33:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2022-12-26:/banshees-of-inisherin.html</id><content type="html">&lt;p&gt;Verdict: See it&lt;/p&gt;
&lt;p&gt;Entertaining, quite funny, unexpected turn. &lt;/p&gt;</content><category term="Movie Review"/><category term="review"/><category term="movie"/><category term="see-it"/></entry><entry><title>"Python itertools.groupby : a clearer example"</title><link href="https://www.parand.com/python-itertoolsgroupby-a-clearer-example.html" rel="alternate"/><published>2013-01-16T10:00:00-08:00</published><updated>2013-01-16T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2013-01-16:/python-itertoolsgroupby-a-clearer-example.html</id><summary type="html">&lt;p&gt;itertools.groupby allows you to group a sorted list (or any sorted iterable) by some key, giving you the grouping key and the list of items grouped by that key.&lt;/p&gt;
&lt;p&gt;For example, say you have a Django the model:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Item&lt;/span&gt;(&lt;span class="n"&gt;models&lt;/span&gt;.&lt;span class="n"&gt;Model&lt;/span&gt;):
    &lt;span class="n"&gt;user&lt;/span&gt;     = &lt;span class="n"&gt;models&lt;/span&gt;.&lt;span class="n"&gt;ForeignKey&lt;/span&gt;( &lt;span class="n"&gt;User&lt;/span&gt;, &lt;span class="n"&gt;verbose_name&lt;/span&gt;=&lt;span class="s"&gt;&amp;quot;User&amp;quot;&lt;/span&gt;, &lt;span class="n"&gt;db_index …&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;itertools.groupby allows you to group a sorted list (or any sorted iterable) by some key, giving you the grouping key and the list of items grouped by that key.&lt;/p&gt;
&lt;p&gt;For example, say you have a Django the model:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Item&lt;/span&gt;(&lt;span class="n"&gt;models&lt;/span&gt;.&lt;span class="n"&gt;Model&lt;/span&gt;):
    &lt;span class="n"&gt;user&lt;/span&gt;     = &lt;span class="n"&gt;models&lt;/span&gt;.&lt;span class="n"&gt;ForeignKey&lt;/span&gt;( &lt;span class="n"&gt;User&lt;/span&gt;, &lt;span class="n"&gt;verbose_name&lt;/span&gt;=&lt;span class="s"&gt;&amp;quot;User&amp;quot;&lt;/span&gt;, &lt;span class="n"&gt;db_index&lt;/span&gt;=&lt;span class="nb"&gt;True&lt;/span&gt; )
    &lt;span class="n"&gt;amount&lt;/span&gt;   = &lt;span class="n"&gt;models&lt;/span&gt;.&lt;span class="n"&gt;DecimalField&lt;/span&gt;( &lt;span class="n"&gt;max_digits&lt;/span&gt;=&lt;span class="mi"&gt;19&lt;/span&gt;, &lt;span class="n"&gt;decimal_places&lt;/span&gt;=&lt;span class="mi"&gt;2&lt;/span&gt;, &lt;span class="k"&gt;default&lt;/span&gt;=&lt;span class="mi"&gt;0&lt;/span&gt;, &lt;span class="n"&gt;null&lt;/span&gt;=&lt;span class="nb"&gt;True&lt;/span&gt;, &lt;span class="n"&gt;blank&lt;/span&gt;=&lt;span class="nb"&gt;True&lt;/span&gt; )
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And you want to group your Items by User. It'd be something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;ordered_items&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;all&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;order_by&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;user&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item_list&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;itertools&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;groupby&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ordered_items&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lambda&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user&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="nb"&gt;print&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item_list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;That'll display the user, followed by all of the Items for that user, for each user.&lt;/p&gt;
&lt;p&gt;Now let's say you wanted to display the user and the total amount for all of the items. You'd do something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;ordered_items&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;all&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;order_by&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;user&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item_list&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;itertools&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;groupby&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ordered_items&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lambda&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user&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="nb"&gt;print&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item_list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"Undo last git commit / merge"</title><link href="https://www.parand.com/undo-last-git-commit-merge.html" rel="alternate"/><published>2012-07-27T10:00:00-07:00</published><updated>2012-07-27T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2012-07-27:/undo-last-git-commit-merge.html</id><summary type="html">&lt;p&gt;Note to self: I quite stupidly merged and committed an unwanted branch into master. Took a surprisingly long time to figure out how to get rid of it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;git reset --hard HEAD^
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Which means reset git to one commit before the current head, effectively getting rid of the last commit …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Note to self: I quite stupidly merged and committed an unwanted branch into master. Took a surprisingly long time to figure out how to get rid of it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;git reset --hard HEAD^
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Which means reset git to one commit before the current head, effectively getting rid of the last commit.&lt;/p&gt;
&lt;p&gt;Also, to undo a merge into master, you can reset back to origin/master with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;git reset --hard origin/master
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;More scenarios for &lt;a href="http://stackoverflow.com/questions/2389361/git-undo-a-merge"&gt;undoing merges on this stackoverflow page&lt;/a&gt;.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Efficiently finding large (size and dimension) images"</title><link href="https://www.parand.com/efficiently-finding-large-size-and-dimension-images.html" rel="alternate"/><published>2012-05-09T10:00:00-07:00</published><updated>2012-05-09T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2012-05-09:/efficiently-finding-large-size-and-dimension-images.html</id><summary type="html">&lt;p&gt;I needed to efficiently find large images (those with dimensions greater than x). Here's what I came up with:&lt;/p&gt;
&lt;p&gt;First, find images whose file size is greater than 3M:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;find . -name &amp;#39;*jpg&amp;#39; -size 3M &amp;gt; /tmp/big-receipts.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now, get the dimensions of each of those images using imagemagick's identify command …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I needed to efficiently find large images (those with dimensions greater than x). Here's what I came up with:&lt;/p&gt;
&lt;p&gt;First, find images whose file size is greater than 3M:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;find . -name &amp;#39;*jpg&amp;#39; -size 3M &amp;gt; /tmp/big-receipts.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now, get the dimensions of each of those images using imagemagick's identify command line utility. The key to using this thing efficiently is to include the "-ping" flag (believe it or not that took me quite a while to figure out):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;identify -ping filename.jpg
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;displays this type of output:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;/tmp/big.jpg JPEG 10200x13200 10200x13200+0+0 8-bit DirectClass 5.54MB 0.000u 0:00.000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now we can put the two together:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;fname&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;`&lt;span class="nv"&gt;cat&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;big&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;receipts&lt;/span&gt;.&lt;span class="nv"&gt;txt&lt;/span&gt;`&lt;span class="c1"&gt;; do identify -ping $fname; done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"Hands On With the BlackBerry Playbook: Actually Quite Nice"</title><link href="https://www.parand.com/hands-on-with-the-blackberry-playbook-actually-quite-nice.html" rel="alternate"/><published>2012-02-27T10:00:00-08:00</published><updated>2012-02-27T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2012-02-27:/hands-on-with-the-blackberry-playbook-actually-quite-nice.html</id><summary type="html">&lt;p&gt;Over the weekend I attended the Blackberry hackathon with the hopes of creating an &lt;a href="http://xpenser.com/"&gt;Xpenser&lt;/a&gt; blackberry app. The RIM folks were nice enough to give away a Playbook to everyone who presented, so I ended up with one.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Blackberry Playbook" src="http://static8.businessinsider.com/image/4ca106617f8b9a5354760400/blackberry-playbook.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I was skeptical, to say the least. I expected a sluggish, ugly …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Over the weekend I attended the Blackberry hackathon with the hopes of creating an &lt;a href="http://xpenser.com/"&gt;Xpenser&lt;/a&gt; blackberry app. The RIM folks were nice enough to give away a Playbook to everyone who presented, so I ended up with one.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Blackberry Playbook" src="http://static8.businessinsider.com/image/4ca106617f8b9a5354760400/blackberry-playbook.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I was skeptical, to say the least. I expected a sluggish, ugly interface with a dearth of applications.&lt;/p&gt;
&lt;p&gt;What I got is quite nice. The blackberry has a very usable interface - it's fast and responsive, and some of the gestures (eg. closing and switching apps) are the best I've seen on a tablet.&lt;/p&gt;
&lt;p&gt;It comes with a nice car racing game (I surprised myself by spending a few hours playing it), and the browser is quite excellent, probably the best I've seen on a tablet.&lt;/p&gt;
&lt;p&gt;The development environment is also rich: you can use HTML or flash as well as native SDKs.&lt;/p&gt;
&lt;p&gt;It doesn't seem to come with a built-in email app (or if it does I've missed it), which is very surprising given the Blackberry pedigree.&lt;/p&gt;
&lt;p&gt;It's also lacking apps and games - the app world feels a bit empty.&lt;/p&gt;
&lt;p&gt;I'm surprised at how much I like the device. I just wish it had more apps.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"SFTP: Specifying Port, SSH key"</title><link href="https://www.parand.com/sftp-specifying-port-ssh-key.html" rel="alternate"/><published>2012-02-23T10:00:00-08:00</published><updated>2012-02-23T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2012-02-23:/sftp-specifying-port-ssh-key.html</id><content type="html">&lt;p&gt;&lt;a href="http://www.mkssoftware.com/docs/man1/sftp.1.asp"&gt;This page&lt;/a&gt; is helpful.&lt;/p&gt;
&lt;p&gt;Specifying port:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;sftp&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;oPort&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;6636&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;IdentityFile&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;my&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;protected&lt;/span&gt;&lt;span class="p"&gt;]](&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;web&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;20120914064722&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//cloudflare.com/email-protection.html)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"Student Loans Are Killing Entrepreneurship"</title><link href="https://www.parand.com/student-loans-are-killing-entrepreneurship.html" rel="alternate"/><published>2012-02-15T10:00:00-08:00</published><updated>2012-02-15T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2012-02-15:/student-loans-are-killing-entrepreneurship.html</id><summary type="html">&lt;p&gt;If you know me you know I'm a huge fan of entrepreneurship - instead of renting yourself out to someone else, start a business that scales. Be your own pimp.&lt;/p&gt;
&lt;p&gt;I gave a guest lecture at UCSD recently espousing this viewpoint. You are cheap right now, I told them, so take …&lt;/p&gt;</summary><content type="html">&lt;p&gt;If you know me you know I'm a huge fan of entrepreneurship - instead of renting yourself out to someone else, start a business that scales. Be your own pimp.&lt;/p&gt;
&lt;p&gt;I gave a guest lecture at UCSD recently espousing this viewpoint. You are cheap right now, I told them, so take advantage. If you wait 10 years to start a company you'll have much higher earning power and much higher personal costs (spouse, mortgage, …) and therefore a much higher opportunity cost when starting a company.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What about our student loans?&lt;/strong&gt; asked one of the students.&lt;/p&gt;
&lt;p&gt;Good question. I don't have a good answer. &lt;/p&gt;
&lt;p&gt;When I went to school I was able to pay my way from the third year onward. I left school with savings instead of debt. I was able to start a company immediately.&lt;/p&gt;
&lt;p&gt;Today students graduate with an average debt of about $27,000 dollars.&lt;/p&gt;
&lt;p&gt;That's just awful. That means they are bound to a job for at least the first part of their career. We're removing the option of starting a company, of producing explosive value, of growing the economy to the benefit of the whole country, for more than 60% of our graduates. &lt;/p&gt;
&lt;p&gt;Think of all of the companies with billions in value created by college students. Think Facebook, Dropbox. We need these. We want these created in the US.&lt;/p&gt;
&lt;p&gt;We have to get education costs under control. We can screw the young generation over to put a few extra bucks in our pockets now, but we'll all end up paying for it when we fall behind other countries who encourage their creative young to be entrepreneurs.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"How To Dynamically Import Python Modules"</title><link href="https://www.parand.com/how-to-dynamically-import-python-modules.html" rel="alternate"/><published>2012-01-11T10:00:00-08:00</published><updated>2012-01-11T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2012-01-11:/how-to-dynamically-import-python-modules.html</id><content type="html">&lt;p&gt;Here's how you import a python module dynamically: say your module is called "mysettings" and it's in the directory "config". Make sure you have a &lt;code&gt;__init__.py&lt;/code&gt; in your "config" directory and use:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;mysettings = __import__(&amp;quot;config.mysettings&amp;quot;, fromlist=[&amp;quot;config&amp;quot;])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is equivalent to&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;config&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mysetings&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"How To Scan Multiple Pages Into a Single PDF on OS X"</title><link href="https://www.parand.com/how-to-scan-multiple-pages-into-a-single-pdf-on-os-x.html" rel="alternate"/><published>2011-11-15T10:00:00-08:00</published><updated>2011-11-15T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2011-11-15:/how-to-scan-multiple-pages-into-a-single-pdf-on-os-x.html</id><summary type="html">&lt;p&gt;My new printer has a document feeder which makes scanning of multiple pages easy, but I didn't know how to kick off the scan on OS X. Turns out it's quite easy:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the OS X Preview app&lt;/li&gt;
&lt;li&gt;Go to the File menu and select Import From Scanner&lt;/li&gt;
&lt;li&gt;Select your …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;My new printer has a document feeder which makes scanning of multiple pages easy, but I didn't know how to kick off the scan on OS X. Turns out it's quite easy:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the OS X Preview app&lt;/li&gt;
&lt;li&gt;Go to the File menu and select Import From Scanner&lt;/li&gt;
&lt;li&gt;Select your printer&lt;/li&gt;
&lt;li&gt;Look for the "Format" option on the right hand page and set it to PDF&lt;/li&gt;
&lt;li&gt;Select the "Create single document" option&lt;/li&gt;
&lt;li&gt;Hit the Scan button&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This will produce a single PDF file with all of the pages of your document, scanned into the location of your choice.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Titanium Studio: How To View Android Log Messages"</title><link href="https://www.parand.com/titanium-studio-how-to-view-android-log-messages.html" rel="alternate"/><published>2011-08-15T10:00:00-07:00</published><updated>2011-08-15T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2011-08-15:/titanium-studio-how-to-view-android-log-messages.html</id><content type="html">&lt;p&gt;Apparently with Titanium Studio it's not possible to see log messages in the Titanium console.&lt;/p&gt;
&lt;p&gt;Here's how you see your log messages:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;adb logcat | grep &amp;quot;TiAPI&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;adb is in the tools directory of your Android sdk.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Easy way to view cookies in Chrome"</title><link href="https://www.parand.com/easy-way-to-view-cookies-in-chrome.html" rel="alternate"/><published>2011-07-27T10:00:00-07:00</published><updated>2011-07-27T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2011-07-27:/easy-way-to-view-cookies-in-chrome.html</id><content type="html">&lt;p&gt;Here's an easy way to see the cookies for the current site in Chrome:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;javascript&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;void&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;cookie&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;cookie&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;cookie&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Via &lt;a href="http://stackoverflow.com/questions/913296/how-to-see-cookie-information-of-chrome-browser"&gt;stackoveflow&lt;/a&gt;.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Uniforms"</title><link href="https://www.parand.com/uniforms.html" rel="alternate"/><published>2011-03-04T10:00:00-08:00</published><updated>2011-03-04T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2011-03-04:/uniforms.html</id><summary type="html">&lt;p&gt;I went to a school that required uniforms (private school in England). We were forced to be uniform.&lt;/p&gt;
&lt;p&gt;This afternoon driving by the high school near my house I was amused to see uniforms everywhere - here a patch of girls all wearing the same types of shorts, with hair pulled …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I went to a school that required uniforms (private school in England). We were forced to be uniform.&lt;/p&gt;
&lt;p&gt;This afternoon driving by the high school near my house I was amused to see uniforms everywhere - here a patch of girls all wearing the same types of shorts, with hair pulled back, there a group of emo kids all wearing shades of near identical clothes.&lt;/p&gt;
&lt;p&gt;It's lovely. We all need to be different in our uniform ways.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Future of Work and New Dial Tones"</title><link href="https://www.parand.com/future-of-work-and-new-dial-tones.html" rel="alternate"/><published>2010-12-08T10:00:00-08:00</published><updated>2010-12-08T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-12-08:/future-of-work-and-new-dial-tones.html</id><summary type="html">&lt;p&gt;My friend &lt;a href="http://paul.kedrosky.com/archives/2010/12/the_future_of_w.html"&gt;Paul Kedrosky's post on one of his main investment theses&lt;/a&gt;, the application of currently consumer oriented technologies to business (DropBox, Twitter, FaceBook, Yelp, …), got me thinking about how the future of work will look.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://parand.com/say/misc/retro-phone.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I've made a career of working far from where I live. I've generally considered …&lt;/p&gt;</summary><content type="html">&lt;p&gt;My friend &lt;a href="http://paul.kedrosky.com/archives/2010/12/the_future_of_w.html"&gt;Paul Kedrosky's post on one of his main investment theses&lt;/a&gt;, the application of currently consumer oriented technologies to business (DropBox, Twitter, FaceBook, Yelp, …), got me thinking about how the future of work will look.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://parand.com/say/misc/retro-phone.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I've made a career of working far from where I live. I've generally considered this a significant pain - there are disadvantages and inefficiencies in being geographically separated from coworkers. Hence I've endured horrible commutes and frequent travel.&lt;/p&gt;
&lt;p&gt;Lately, however, I've been reconsidering. My office is about 30 minutes from my house, but I end up not going in more and more these days. The 1 hour roundtrip is simply wasted time, and the traditional 9-5 is an artificial constraint on both work and non-work activities.&lt;/p&gt;
&lt;p&gt;The turning point, not surprisingly, was technology driven - earlier this year I was working on a shared presentation and document with 2 colleagues. We met in person twice, and the third time we used Google Wave (rip) for shared document editing and iChat for voice and video communication.&lt;/p&gt;
&lt;p&gt;I was shocked at how much more efficient the third session was. I despise video calls, but in this case it was background, mainly to see who was paying attention and who was tuned out. The shared document with real-time edits worked fabulously well - one could write stream of consciousness thoughts, and before finishing the paragraph have his work edited and polished by the other two.&lt;/p&gt;
&lt;p&gt;These days I find my most efficient working relationships require little in-person interaction. What they do require is a host of enabling technologies we take for granted.&lt;/p&gt;
&lt;p&gt;I'm still a huge believer in the value of in-person interactions - the best ideas generally pop up over lunch or other informal settings. But in-person interaction doesn't require the traditional office setting and trappings.&lt;/p&gt;
&lt;p&gt;The work style adopted by startups today will make its way to large business, and the services that are the lifeline of that style will become the dial-tone of business. As Paul points out this will drive the creation of a number of significant companies to provide those dial-tones. And with any luck I'll have an opportunity to invest if a few of them &lt;img alt=";-)" src="/web/20101213011206im_/http://parand.com/say/wp-includes/images/smilies/icon_wink.gif"&gt;&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Generating static html from markdown in python"</title><link href="https://www.parand.com/generating-static-html-from-markdown-in-python.html" rel="alternate"/><published>2010-11-29T10:00:00-08:00</published><updated>2010-11-29T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-11-29:/generating-static-html-from-markdown-in-python.html</id><content type="html">&lt;p&gt;Note to self, for future reference.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://markdoc.org/ref/markup"&gt;Markdown reference&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Generating static html:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;markdown2&lt;/span&gt;
&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;classification.html&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;w&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;markdown2&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;markdown_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;classification.md&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;extras&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;code-friendly&amp;quot;&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"Retention Bonuses Don’t Work"</title><link href="https://www.parand.com/retention-bonuses-dont-work.html" rel="alternate"/><published>2010-11-19T10:00:00-08:00</published><updated>2010-11-19T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-11-19:/retention-bonuses-dont-work.html</id><content type="html">&lt;p&gt;Retention bonuses don't work because they only motivate presence, not contribution.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"mo.com Interviews Me"</title><link href="https://www.parand.com/mocom-interviews-me.html" rel="alternate"/><published>2010-11-08T10:00:00-08:00</published><updated>2010-11-08T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-11-08:/mocom-interviews-me.html</id><content type="html">&lt;p&gt;The lovely folks at mo.com recently asked me about my experiences at Yahoo, the background and business model for Xpenser, and thoughts on funding and raising VC money. The interview has been &lt;a href="http://www.mo.com/parand-darugar"&gt;published here&lt;/a&gt;, drop by and take a gander.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"How To Run A Command On Multiple Linux Boxes"</title><link href="https://www.parand.com/how-to-run-a-command-on-multiple-linux-boxes.html" rel="alternate"/><published>2010-10-29T10:00:00-07:00</published><updated>2010-10-29T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-10-29:/how-to-run-a-command-on-multiple-linux-boxes.html</id><summary type="html">&lt;p&gt;Here's a handy way of running a command on multiple boxes. In this case I wanted to check disk space on a series of machines.&lt;/p&gt;
&lt;p&gt;Assuming you're using bash as your shell, the following will list the hostname and run df on machines racb13 through racb28 and spit out the …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Here's a handy way of running a command on multiple boxes. In this case I wanted to check disk space on a series of machines.&lt;/p&gt;
&lt;p&gt;Assuming you're using bash as your shell, the following will list the hostname and run df on machines racb13 through racb28 and spit out the results.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;&lt;span class="mf"&gt;13..28&lt;/span&gt;&lt;span class="err"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;do&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;racb$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;echo `hostname`; df -h | grep /data&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Note that ssh has to be setup to allow password-less login and so forth, but I'm assuming you're smart enough to know how to do that or can look it up.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Art"</title><link href="https://www.parand.com/art.html" rel="alternate"/><published>2010-07-23T10:00:00-07:00</published><updated>2010-07-23T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-07-23:/art.html</id><content type="html">&lt;p&gt;I don't know why but I'm seriously in love with this drawing from the six year old; it seems to have a real style. Better than anything I could draw, methinks.&lt;br&gt;
&lt;img alt="Desert Scene by Kamran" src="http://farm5.static.flickr.com/4078/4797873058_2cbb738eb5.jpg"&gt;&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"How To Be A Good Participant On A Panel: Disagree"</title><link href="https://www.parand.com/how-to-be-a-good-participant-on-a-panel-disagree.html" rel="alternate"/><published>2010-03-04T10:00:00-08:00</published><updated>2010-03-04T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-03-04:/how-to-be-a-good-participant-on-a-panel-disagree.html</id><summary type="html">&lt;p&gt;&lt;a href="http://www.bothsidesofthetable.com/2010/03/03/making-the-most-out-of-sitting-on-panels/"&gt;Mark Suster&lt;/a&gt; and &lt;a href="http://www.avc.com/a_vc/2010/03/panels.html"&gt;Fred Wilson&lt;/a&gt; have both posted on the topic of being a good panelist. I'll throw in the best advice I ever got on the topic (from &lt;a href="http://teamsoa.com/"&gt;Alex&lt;/a&gt;, who got it from someone else):&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Disagree with other panelists.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A panel of people agreeing with each other is generally …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;a href="http://www.bothsidesofthetable.com/2010/03/03/making-the-most-out-of-sitting-on-panels/"&gt;Mark Suster&lt;/a&gt; and &lt;a href="http://www.avc.com/a_vc/2010/03/panels.html"&gt;Fred Wilson&lt;/a&gt; have both posted on the topic of being a good panelist. I'll throw in the best advice I ever got on the topic (from &lt;a href="http://teamsoa.com/"&gt;Alex&lt;/a&gt;, who got it from someone else):&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Disagree with other panelists.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A panel of people agreeing with each other is generally tremendously boring, and any topic that's interesting enough to be brought up as a question to panel must have at least two sides that can be argued.&lt;/p&gt;
&lt;p&gt;So argue the other side. Find someone else on the panel willing to go toe to toe with you, and disagree with what they say. The point is not to start a fight, but to create an engaging discussion. It'll force you to think on your feet and it'll entertain the audience.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Django: Using The Permission System"</title><link href="https://www.parand.com/django-using-the-permission-system.html" rel="alternate"/><published>2010-02-19T10:00:00-08:00</published><updated>2010-02-19T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-02-19:/django-using-the-permission-system.html</id><summary type="html">&lt;p&gt;I was surprised at how little information I found on making use of Django's permission system. Here are some quick notes on one way to use it:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Groups&lt;/em&gt; are groups of users. For example, you could define a group of users who have premium accounts, or have been verified in …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I was surprised at how little information I found on making use of Django's permission system. Here are some quick notes on one way to use it:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Groups&lt;/em&gt; are groups of users. For example, you could define a group of users who have premium accounts, or have been verified in some way, or are somehow special:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;django.contrib.auth.models&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Group&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Permission&lt;/span&gt;
&lt;span class="n"&gt;special_users&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Group&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Special Users&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;special_users&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;save&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;really_special_users&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Group&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Super Special Users&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;really_special_users&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;save&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now you have two groups defined and can define permissions for them. Django associates permissions with models (note: not model instances, but models). You'll need to select a model to apply the permissions to, and do a small dance with "ContentType" to find that model's content type:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;django.contrib.contenttypes.models&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ContentType&lt;/span&gt;
&lt;span class="n"&gt;somemodel_ct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ContentType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app_label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;myapp&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;somemodel&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;can_view&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Permission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Can View&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;codename&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;can_view_something&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;                       &lt;/span&gt;&lt;span class="n"&gt;content_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;somemodel_ct&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;can_view&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;save&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;can_modify&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Permission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Can Modify&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;codename&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;can_modify_something&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;                       &lt;/span&gt;&lt;span class="n"&gt;content_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;somemodel_ct&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;can_modify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;save&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You've now defined two permissions and can associate them with your Groups:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;special_users.permissions.add(can_view)
really_special_users.permissions = [can_view, can_modify]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Our groups and their associated permissions are ready to go. Now we just have to associate these permissions with users:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;jack&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;protected&lt;/span&gt;&lt;span class="p"&gt;]](&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;web&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;20120325165629&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//cloudflare.com/email-protection.html)&amp;#39;)&lt;/span&gt;
&lt;span class="n"&gt;jack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;special_users&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;jill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;protected&lt;/span&gt;&lt;span class="p"&gt;]](&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;web&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;20120325165629&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//cloudflare.com/email-protection.html)&amp;#39;)&lt;/span&gt;
&lt;span class="n"&gt;jill&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;really_special_users&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;We're all done. Now we can check the users' permissions:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; jack.has_perm(&amp;#39;myapp.can_view_something&amp;#39;)
True
&amp;gt;&amp;gt;&amp;gt; jack.has_perm(&amp;#39;myapp.can_modify_something&amp;#39;)
False

&amp;gt;&amp;gt;&amp;gt; jill.has_perm(&amp;#39;myapp.can_view_something&amp;#39;)
True
&amp;gt;&amp;gt;&amp;gt; jill.has_perm(&amp;#39;myapp.can_modify_something&amp;#39;)
True
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And to use it in your templates:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nv"&gt;perms.myapp.can_view_something&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;span class="x"&gt;Here is something for you to see.&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;span class="x"&gt;Can&amp;#39;t show you!&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;endif&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"Hyper Competitive Sleep Losing Entrepreneurs?"</title><link href="https://www.parand.com/hyper-competitive-sleep-losing-entrepreneurs.html" rel="alternate"/><published>2010-01-31T10:00:00-08:00</published><updated>2010-01-31T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-01-31:/hyper-competitive-sleep-losing-entrepreneurs.html</id><summary type="html">&lt;p&gt;I remarked to a friend that &lt;a href="http://www.bothsidesofthetable.com/"&gt;Mark Suster&lt;/a&gt;'s entrepreneurial roots show in his approach to being a VC - he's come out of nowhere and in short order aggressively pushed himself into being one of the most relevant voices out there. He seems to be working a lot harder than …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I remarked to a friend that &lt;a href="http://www.bothsidesofthetable.com/"&gt;Mark Suster&lt;/a&gt;'s entrepreneurial roots show in his approach to being a VC - he's come out of nowhere and in short order aggressively pushed himself into being one of the most relevant voices out there. He seems to be working a lot harder than the others guys, exactly as you'd expect an entrepreneur to be. Not exactly what you'd expect of a VC.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.bothsidesofthetable.com/"&gt;His blog&lt;/a&gt; is fantastic, and I quite often agree with his advice. &lt;/p&gt;
&lt;p&gt;That's why I found it odd that his &lt;a href="http://www.bothsidesofthetable.com/2010/01/29/the-best-entrepreneurs-are-hyper-competitive-hate-losing/"&gt;The Best Entrepreneurs Are Hyper Competitive &amp;amp; Hate Losing&lt;/a&gt; struck such a dissonant chord with me. &lt;/p&gt;
&lt;p&gt;Shuffling through the successful business people I know and trying to gauge whether they would be the type of people who are obsessed with winning, even in a family game of scrabble, I don't come to a clear conclusion. I know hyper competitive people, but I also know plenty of people who are able to separate their business behavior from their personal behavior. And not obsess with beating the competition.&lt;/p&gt;
&lt;p&gt;Maybe that's what's not sitting well with me - Mark's definition of winning seems to be beating the competition. &lt;/p&gt;
&lt;p&gt;Some of the best entrepreneurs I know don't obsess with the competition. They obsess with their own behavior. &lt;/p&gt;
&lt;p&gt;Here's a contrived example - look at Apple. Do you see Jobs competing with the others in the industries he enters, or do you see him trying create the best possible product, distinctly separate from what his competitors are doing?&lt;/p&gt;
&lt;p&gt;Frankly I have a hard time picturing a lot of these guys stressing out over scrabble or Guitar Hero. &lt;/p&gt;
&lt;p&gt;Mark's a very successful guy and his approach has certainly worked for him, but I disagree that you need to be obsessed with winning in the way that Mark describes it. &lt;/p&gt;
&lt;p&gt;Look at this way: you could destroy all your competitors and still not win. You could also win without destroying any of your competitors.&lt;/p&gt;
&lt;p&gt;First, pick the right game. Then, pay attention to playing that game as best it can be played. Competing may be an important tactical part of playing the game, but it's probably not the part to obsess over.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Django-mptt: Tree Storage in Django: A Brief Overview"</title><link href="https://www.parand.com/django-mptt-tree-storage-in-django-a-brief-overview.html" rel="alternate"/><published>2010-01-24T10:00:00-08:00</published><updated>2010-01-24T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-01-24:/django-mptt-tree-storage-in-django-a-brief-overview.html</id><summary type="html">&lt;p&gt;&lt;a href="/web/20120414080551/http://code.google.com/p/django-mptt/"&gt;django-mptt&lt;/a&gt; is a library for storing tree oriented data using the Django ORM. It allows you to place your model instances into a tree structure and efficiently query for ancestors and children.&lt;/p&gt;
&lt;p&gt;Here's a brief tutorial on how to use it:&lt;/p&gt;
&lt;p&gt;After installing, you'll need to modify your model to …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;a href="/web/20120414080551/http://code.google.com/p/django-mptt/"&gt;django-mptt&lt;/a&gt; is a library for storing tree oriented data using the Django ORM. It allows you to place your model instances into a tree structure and efficiently query for ancestors and children.&lt;/p&gt;
&lt;p&gt;Here's a brief tutorial on how to use it:&lt;/p&gt;
&lt;p&gt;After installing, you'll need to modify your model to include a "parent" field, and register it with mptt:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Contact&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;db_index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;True&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="n"&gt;role&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CharField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mh"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;blank&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;parent&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&amp;#39;&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;&amp;#39;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;null&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;blank&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;related_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;#39;&lt;/span&gt;&lt;span class="n"&gt;children&lt;/span&gt;&lt;span class="p"&gt;&amp;#39;)&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;def&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;__unicode__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Person: &amp;lt;%s&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;email&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="n"&gt;mptt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;mptt dynamically adds fields to your model, so you'll need to syncdb after you've added the parent attribute and the mptt.register call to your model.&lt;/p&gt;
&lt;p&gt;The basics are fairly easy to use:&lt;/p&gt;
&lt;p&gt;To move a node to the root of the tree, use move_to with a targe of None:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;person1.move_to(None)
person1.save()
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;To make a node the child of another, set its parent:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;person2.parent = person1
person2.save()
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;To find the children of a node, use the children field:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;person1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;children&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;all&lt;/span&gt;&lt;span class="p"&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="n"&gt;Person&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;protected&lt;/span&gt;&lt;span class="p"&gt;]](&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;web&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;20120414080551&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//cloudflare.com/email-protection.html)&amp;gt;&amp;gt;, &amp;lt;Person: Person: &amp;lt;[[email protected]](/web/20120414080551/http://cloudflare.com/email-protection.html)&amp;gt;&amp;gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here's a little snippet of code to setup a 15 node tree where each node has two child nodes:  &lt;/p&gt;
&lt;p&gt;[UPDATE] The code in this snippet is not correct - you have to save each node as you update it, then look it up again. You can't modify a node, save it, then use the reference you already have for it. I'll update the code when I get a chance&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;contacts&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;[]&lt;/span&gt;
&lt;span class="n"&gt;people&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;[]&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;range&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="err"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;mod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Contact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;&amp;quot;@testing.com&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;save&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;contacts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&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="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;mod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;save&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;people&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;people&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;move_to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Root&lt;/span&gt;
&lt;span class="n"&gt;people&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;save&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;range&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;15&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;people&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parent&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;people&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;(n-1)/2&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;people&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;save&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now let's take a look around:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;people&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="n"&gt;parent&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;protected&lt;/span&gt;&lt;span class="p"&gt;]](&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;web&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;20120414080551&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//cloudflare.com/email-protection.html)&amp;gt;&amp;gt;&lt;/span&gt;

&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;people&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="n"&gt;children&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;all&lt;/span&gt;&lt;span class="p"&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="n"&gt;Person&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;protected&lt;/span&gt;&lt;span class="p"&gt;]](&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;web&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;20120414080551&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//cloudflare.com/email-protection.html)&amp;gt;&amp;gt;, &amp;lt;Person: Person: &amp;lt;[[email protected]](/web/20120414080551/http://cloudflare.com/email-protection.html)&amp;gt;&amp;gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now let's move things around a bit; we'll take person3, which is 2 levels down from the root, and make it a direct child of the root:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;people&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="n"&gt;parent&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;people&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="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;people&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="n"&gt;save&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;people&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="n"&gt;children&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;all&lt;/span&gt;&lt;span class="p"&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="n"&gt;Person&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;protected&lt;/span&gt;&lt;span class="p"&gt;]](&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;web&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;20120414080551&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//cloudflare.com/email-protection.html)&amp;gt;&amp;gt; &amp;lt;Person: Person: &amp;lt;[[email protected]](/web/20120414080551/http://cloudflare.com/email-protection.html)&amp;gt;&amp;gt;, &amp;lt;Person: Person: &amp;lt;[[email protected]](/web/20120414080551/http://cloudflare.com/email-protection.html)&amp;gt;&amp;gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And we can look at the ancestors of a given node:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;people[14].get_ancestors()
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>Fantastic Mr. Fox: See It</title><link href="https://www.parand.com/fantastic-mr-fox-see-it.html" rel="alternate"/><published>2010-01-23T10:00:00-08:00</published><updated>2010-01-23T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-01-23:/fantastic-mr-fox-see-it.html</id><summary type="html">&lt;hr&gt;
&lt;p&gt;I'm a big fan of &lt;a href="http://www.imdb.com/title/tt0432283/"&gt;Fantastic Mr. Fox&lt;/a&gt;. We just watched it again and it was a hit with everyone from the 2 year old to grandma. &lt;/p&gt;
&lt;p&gt;The dialog an voice acting are excellent, and the animation is really refreshing. The story is smart and is different enough from your …&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;I'm a big fan of &lt;a href="http://www.imdb.com/title/tt0432283/"&gt;Fantastic Mr. Fox&lt;/a&gt;. We just watched it again and it was a hit with everyone from the 2 year old to grandma. &lt;/p&gt;
&lt;p&gt;The dialog an voice acting are excellent, and the animation is really refreshing. The story is smart and is different enough from your typical Disney fare to be a welcome change. &lt;/p&gt;
&lt;p&gt;I recommend it, go see it.&lt;/p&gt;</content><category term="Movie Review"/><category term="review"/><category term="book"/><category term="see-it"/></entry><entry><title>"Feels Like A New Stage Of The Web"</title><link href="https://www.parand.com/feels-like-a-new-stage-of-the-web.html" rel="alternate"/><published>2010-01-09T10:00:00-08:00</published><updated>2010-01-09T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-01-09:/feels-like-a-new-stage-of-the-web.html</id><summary type="html">&lt;p&gt;I was doing some log analysis this morning and was struck by the variety of user agents accessing &lt;a href="http://xpenser.com/"&gt;Xpenser&lt;/a&gt;. Quite a bit of mobile access with quite a variety of different browsers, as well as some more exotic items (various tablet PCs I don't recognize, etc). &lt;/p&gt;
&lt;p&gt;Then there's the API …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I was doing some log analysis this morning and was struck by the variety of user agents accessing &lt;a href="http://xpenser.com/"&gt;Xpenser&lt;/a&gt;. Quite a bit of mobile access with quite a variety of different browsers, as well as some more exotic items (various tablet PCs I don't recognize, etc). &lt;/p&gt;
&lt;p&gt;Then there's the API access that's been picking up quite significantly - in fact, I wouldn't be surprised if it overtakes regular web access in a little while.&lt;/p&gt;
&lt;p&gt;For quite a while the web we had a fairly uniform set of entry points - IE and FireFox for the most part, with a smattering of others thrown in. There is so much more variety now, and the variety is significant - for example, the difference between a mobile device and a desktop browser is much more significant than between IE and FF.&lt;/p&gt;
&lt;p&gt;I'm hoping other modes of access become commonplace as well - boxee, tablet PCs, etc.&lt;/p&gt;
&lt;p&gt;It feels like we're at a transition point from uniformity to diversity again. This will mean pain the short term as we adjust, but a richer and more encompassing experience once we make it to the other side. &lt;/p&gt;
&lt;p&gt;I'm looking forward to it.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Move Files Older Than X Days To Another Directory"</title><link href="https://www.parand.com/move-files-older-than-x-days-to-another-directory.html" rel="alternate"/><published>2010-01-08T10:00:00-08:00</published><updated>2010-01-08T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2010-01-08:/move-files-older-than-x-days-to-another-directory.html</id><content type="html">&lt;p&gt;Here's a little script for finding files modified more than 7 days ago and moving them to another directory:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nx"&gt;find&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="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;mtime&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;print&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;old_files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txt&lt;/span&gt;
&lt;span class="nx"&gt;cat&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;old_files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txt&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;read&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;line&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;do&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;mv&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;quot;$line&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;old_files&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="nx"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"How To List Files In A Package in Ubuntu"</title><link href="https://www.parand.com/how-to-list-files-in-a-package-in-ubuntu.html" rel="alternate"/><published>2009-11-15T10:00:00-08:00</published><updated>2009-11-15T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-11-15:/how-to-list-files-in-a-package-in-ubuntu.html</id><content type="html">&lt;p&gt;dpkg -L package-name&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"How To Enable Vi Syntax Highlighting In Ubuntu"</title><link href="https://www.parand.com/how-to-enable-vi-syntax-highlighting-in-ubuntu.html" rel="alternate"/><published>2009-10-28T10:00:00-07:00</published><updated>2009-10-28T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-10-28:/how-to-enable-vi-syntax-highlighting-in-ubuntu.html</id><summary type="html">&lt;p&gt;Note to self, as I seem to need to do this on every new install:&lt;/p&gt;
&lt;p&gt;Ubuntu ships with vim-tiny, which doesn't support syntax highlighting. Do this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;sudo apt-get remove vim-tiny
sudo apt-get install vim
sudo vi /etc/vim/vimrc
( Remove the quote mark from the &amp;quot;syntax on&amp;quot; line, uncommenting it …&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;Note to self, as I seem to need to do this on every new install:&lt;/p&gt;
&lt;p&gt;Ubuntu ships with vim-tiny, which doesn't support syntax highlighting. Do this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;sudo apt-get remove vim-tiny
sudo apt-get install vim
sudo vi /etc/vim/vimrc
( Remove the quote mark from the &amp;quot;syntax on&amp;quot; line, uncommenting it)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"The Power of Stories In Shaping Views of Cultures"</title><link href="https://www.parand.com/the-power-of-stories-in-shaping-views-of-cultures.html" rel="alternate"/><published>2009-10-17T10:00:00-07:00</published><updated>2009-10-17T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-10-17:/the-power-of-stories-in-shaping-views-of-cultures.html</id><content type="html">&lt;p&gt;Impressive Ted Talk by Chimamanda Adichie on how stories, and in particular "single stories", shape our views of cultures. Many parallels with how people typically see Iran. &lt;/p&gt;
&lt;p&gt;A great quote from the talk: "&lt;em&gt;The problem with stereotypes is not that they are untrue - it is that they are incomplete&lt;/em&gt;". &lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Eclipse + PyDev : I Recommend It"</title><link href="https://www.parand.com/eclipse-pydev-i-recommend-it.html" rel="alternate"/><published>2009-10-11T10:00:00-07:00</published><updated>2009-10-11T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-10-11:/eclipse-pydev-i-recommend-it.html</id><summary type="html">&lt;p&gt;I used to be a vi guy who finally made the move to graphical editors. I looked for the simplest, lightest possible solutions, using &lt;a href="http://www.contexteditor.org/"&gt;ConTEXT&lt;/a&gt; for quite a while.&lt;/p&gt;
&lt;p&gt;Some years ago I was forced into using Eclipse for reasons I can't quite recall; probably Java development. I didn't like …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I used to be a vi guy who finally made the move to graphical editors. I looked for the simplest, lightest possible solutions, using &lt;a href="http://www.contexteditor.org/"&gt;ConTEXT&lt;/a&gt; for quite a while.&lt;/p&gt;
&lt;p&gt;Some years ago I was forced into using Eclipse for reasons I can't quite recall; probably Java development. I didn't like it - the forced Project concept, the bloat, the general slowness.&lt;/p&gt;
&lt;p&gt;Eventually I got comfortable with it, got &lt;a href="http://pydev.org/"&gt;PyDev&lt;/a&gt; installed, and made it my primary development environment. These days most of my development lives in Eclipse.&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://pydev.org/images/pydev_banner2.gif"&gt;&lt;/p&gt;
&lt;p&gt;With the 1.5 release PyDev included quite a few previously pay-only features in the free / open source version. Since then I've found I've become even more productive in the environment, and now actually enjoy it.&lt;/p&gt;
&lt;p&gt;In particular, the code analysis is very useful. I love the fact that it points out unused imports and variables as well as syntax errors. Going through old code I was surprised at how many spurious imports I had, as well as a few actual errors in code that had been in production for several years in rarely exercised branches.&lt;/p&gt;
&lt;p&gt;If you're doing python development I recommend you take a look at Eclipse+PyDev. I was surprised at the level of increased productivity it brought me.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"How Interviewing Job Applicants Has Changed"</title><link href="https://www.parand.com/how-interviewing-job-applicants-has-changed.html" rel="alternate"/><published>2009-10-11T10:00:00-07:00</published><updated>2009-10-11T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-10-11:/how-interviewing-job-applicants-has-changed.html</id><summary type="html">&lt;p&gt;I'm noticing how much the practice of finding a candidate and interviewing them has changed over the years.&lt;/p&gt;
&lt;p&gt;First step is to look up the person on the web. Since I'm looking for a technical person I'm expecting a blog, contributions to open source projects, a twitter presence, etc. If …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I'm noticing how much the practice of finding a candidate and interviewing them has changed over the years.&lt;/p&gt;
&lt;p&gt;First step is to look up the person on the web. Since I'm looking for a technical person I'm expecting a blog, contributions to open source projects, a twitter presence, etc. If I don't find them, the candidate becomes less attractive.&lt;/p&gt;
&lt;p&gt;If I do find a blog or twitter feed, I take some time to read them. You can tell a lot about a person with just a short overview - for example, even a delicious feed can give you a very good feel for how good someone is technically.&lt;/p&gt;
&lt;p&gt;Hopefully the person has an open source project or two they've contributed. If so you can dive right into the code and get a good sense of their skills at work. I love this - you can see great coders almost immediately. And of course bad ones.&lt;/p&gt;
&lt;p&gt;If the person is still looking good it's time for a review of the resume and their linkedin profile.&lt;/p&gt;
&lt;p&gt;By the time I followup with the person I have a very good sense of who this person is, what they've done in the past, and what their real-world coding looks like. The people who make it to the interview are so well filtered you almost can't go wrong.&lt;/p&gt;
&lt;p&gt;It's very time consuming, but if you're as fanatical about hiring good people as I am it's worth it.&lt;/p&gt;
&lt;p&gt;Contrast this with the old pile-o-resumes approach, or the recruiter-filter-by-keyword approach, and I think we're in a much better place.&lt;/p&gt;
&lt;p&gt;Now if I could only find a recruiter I could trust to do the technical deep dive I've described here and be ingenious enough to find diamonds in the rough I'd be a very happy man.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Yahoo Mail WTF?!"</title><link href="https://www.parand.com/yahoo-mail-wtf.html" rel="alternate"/><published>2009-09-28T10:00:00-07:00</published><updated>2009-09-28T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-09-28:/yahoo-mail-wtf.html</id><summary type="html">&lt;p&gt;I still have a big soft spot in my heart for Yahoo, but Yahoo mail, WTF?&lt;/p&gt;
&lt;p&gt;&lt;img alt="Yahoo Mail WTF?" src="http://parand.com/say/misc/yahoo-mail-wtf.png"&gt;&lt;/p&gt;
&lt;p&gt;Of the entire screen only the area I've highlighted in orange is dedicated to the contents of the message. And this is with the app maximized to full screen.&lt;/p&gt;
&lt;p&gt;The interface is unusable as …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I still have a big soft spot in my heart for Yahoo, but Yahoo mail, WTF?&lt;/p&gt;
&lt;p&gt;&lt;img alt="Yahoo Mail WTF?" src="http://parand.com/say/misc/yahoo-mail-wtf.png"&gt;&lt;/p&gt;
&lt;p&gt;Of the entire screen only the area I've highlighted in orange is dedicated to the contents of the message. And this is with the app maximized to full screen.&lt;/p&gt;
&lt;p&gt;The interface is unusable as a mail reader: I can't read the email message.&lt;/p&gt;
&lt;p&gt;How on earth did the product people agree to this? Where's the customer advocate?&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"What Should I Read Next?"</title><link href="https://www.parand.com/what-should-i-read-next.html" rel="alternate"/><published>2009-02-16T10:00:00-08:00</published><updated>2009-02-16T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-02-16:/what-should-i-read-next.html</id><summary type="html">&lt;p&gt;I was thinking about what book to read next and it occurred to me to ask you nice people. I'm in the mood for something factual but interesting - something like &lt;a href="http://www.amazon.com/Prize-Epic-Quest-Money-Power/dp/0671799320/"&gt;The Prize&lt;/a&gt;, if you're familiar with that. I was intrigued by &lt;a href="http://www.amazon.com/Fiasco-American-Military-Adventure-Iraq/dp/0143038915/"&gt;Fiasco&lt;/a&gt; but I haven't looked into it.&lt;/p&gt;
&lt;p&gt;So what …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I was thinking about what book to read next and it occurred to me to ask you nice people. I'm in the mood for something factual but interesting - something like &lt;a href="http://www.amazon.com/Prize-Epic-Quest-Money-Power/dp/0671799320/"&gt;The Prize&lt;/a&gt;, if you're familiar with that. I was intrigued by &lt;a href="http://www.amazon.com/Fiasco-American-Military-Adventure-Iraq/dp/0143038915/"&gt;Fiasco&lt;/a&gt; but I haven't looked into it.&lt;/p&gt;
&lt;p&gt;So what do you say, what should I read next?&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Another Python Convert"</title><link href="https://www.parand.com/another-python-convert.html" rel="alternate"/><published>2009-02-13T10:00:00-08:00</published><updated>2009-02-13T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-02-13:/another-python-convert.html</id><content type="html">&lt;p&gt;Looks like I've finally converted &lt;a href="http://teamsoa.com/"&gt;Alex&lt;/a&gt; to Python as well. "This is actually shorter than perl and still makes sense". Be forewarned - if you code with me, you'll be doing Python in no time.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Ctrl-Q, My New Favorite Eclipse Hotkey"</title><link href="https://www.parand.com/ctrl-q-my-new-favorite-eclipse-hotkey.html" rel="alternate"/><published>2009-02-13T10:00:00-08:00</published><updated>2009-02-13T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-02-13:/ctrl-q-my-new-favorite-eclipse-hotkey.html</id><summary type="html">&lt;p&gt;Due to &lt;a href="/say/index.php/2009/02/13/did-i-mention-i-hate-the-mac.html"&gt;aforementioned OS X stupidity&lt;/a&gt; with the Home and End keys, my new favorite Eclipse hotkey is Ctrl-Q. It takes you to the location of your last edit. So next time you hit the End key to go to the end of the line but end up at the …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Due to &lt;a href="/say/index.php/2009/02/13/did-i-mention-i-hate-the-mac.html"&gt;aforementioned OS X stupidity&lt;/a&gt; with the Home and End keys, my new favorite Eclipse hotkey is Ctrl-Q. It takes you to the location of your last edit. So next time you hit the End key to go to the end of the line but end up at the end of the file and curse Jobs and his cult, remember to hit Ctrl-Q to go back to where you should be.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"San Jose San Fran Next Week, Drop Me A Line If You Want To Meet"</title><link href="https://www.parand.com/san-jose-san-fran-next-week-drop-me-a-line-if-you-want-to-meet.html" rel="alternate"/><published>2009-02-03T10:00:00-08:00</published><updated>2009-02-03T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-02-03:/san-jose-san-fran-next-week-drop-me-a-line-if-you-want-to-meet.html</id><content type="html">&lt;p&gt;The title pretty much says it; I'm planning an SJC/SF trip next week, if you want to meet or chat drop me a line - Darugar at gmail.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"On Concurrency, Threads, and Python"</title><link href="https://www.parand.com/on-concurrency-threads-and-python.html" rel="alternate"/><published>2009-02-01T10:00:00-08:00</published><updated>2009-02-01T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-02-01:/on-concurrency-threads-and-python.html</id><content type="html">&lt;p&gt;Nice and detailed article from Jesse Noller on &lt;a href="http://jessenoller.com/2009/02/01/python-threads-and-the-global-interpreter-lock/"&gt;concurrency, threads, the GIL, and Python&lt;/a&gt;. Worth a read; I learned a lot from it.&lt;/p&gt;
&lt;p&gt;For the record I'm one of the people who doesn't think threads are not the true solution to the concurrency problem.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>Books Cannot Be Owned</title><link href="https://www.parand.com/books-cannot-be-owned.html" rel="alternate"/><published>2009-01-25T10:00:00-08:00</published><updated>2009-01-25T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-01-25:/books-cannot-be-owned.html</id><summary type="html">&lt;hr&gt;
&lt;p&gt;Wikihow's &lt;a href="http://www.wikihow.com/Stop-Accumulating-Books"&gt;How To Stop Accumulating Books&lt;/a&gt; has been making the rounds in blogs and delicious popular. Reminds me of the ultimate book non-accumulator, a good friend of my dad's.&lt;/p&gt;
&lt;p&gt;This particular friend of my dad's would always bring me books when he came to visit. I was a voracious reader …&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;Wikihow's &lt;a href="http://www.wikihow.com/Stop-Accumulating-Books"&gt;How To Stop Accumulating Books&lt;/a&gt; has been making the rounds in blogs and delicious popular. Reminds me of the ultimate book non-accumulator, a good friend of my dad's.&lt;/p&gt;
&lt;p&gt;This particular friend of my dad's would always bring me books when he came to visit. I was a voracious reader, to the point where people made fun of me for it, so I always loved his visits. And he brought interesting books - not children's books, but histories, etc. I think he brought me Animal Farm when I was 8 or 9.&lt;/p&gt;
&lt;p&gt;As I got older I started to notice something odd about the books - they didn't belong to him.&lt;/p&gt;
&lt;p&gt;Eventually I found out he didn't own any books. He'd take a book from you, read it, and give it to someone else. Usually without permission.&lt;/p&gt;
&lt;p&gt;I was fascinated. I remember asking him about it, and he told me: books cannot be owned. Ideas are the ultimate expression of freedom, and to cage them is unnatural. Books are for reading and for passing on.&lt;/p&gt;
&lt;p&gt;That made a big impression on me. I've always thought sharing books with friends is the most amazing gift.&lt;/p&gt;
&lt;p&gt;Anyway, that's why I've never returned that book you lent me &lt;img alt=";-)" src="/web/20090201172627im_/http://parand.com/say/wp-includes/images/smilies/icon_wink.gif"&gt;&lt;/p&gt;</content><category term="Quotes"/><category term="quote"/></entry><entry><title>"Facebook: Nice Place To Visit, But I Wouldn’t Want To Live There"</title><link href="https://www.parand.com/facebook-nice-place-to-visit-but-i-wouldnt-want-to-live-there.html" rel="alternate"/><published>2009-01-25T10:00:00-08:00</published><updated>2009-01-25T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-01-25:/facebook-nice-place-to-visit-but-i-wouldnt-want-to-live-there.html</id><summary type="html">&lt;p&gt;Yet another &lt;a href="http://scobleizer.com/2009/01/24/facebook-kicks-off-ifart-author-for-having-too-many-friends/"&gt;Scoble post on a facebook accounts being closed&lt;/a&gt;, this time with the iFart app author.&lt;/p&gt;
&lt;p&gt;Facebook is like Disney Land. It's a nice and enjoyable place, but it has its own special governance. It can decide when to let you in and when to throw you out.&lt;/p&gt;
&lt;p&gt;It's …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Yet another &lt;a href="http://scobleizer.com/2009/01/24/facebook-kicks-off-ifart-author-for-having-too-many-friends/"&gt;Scoble post on a facebook accounts being closed&lt;/a&gt;, this time with the iFart app author.&lt;/p&gt;
&lt;p&gt;Facebook is like Disney Land. It's a nice and enjoyable place, but it has its own special governance. It can decide when to let you in and when to throw you out.&lt;/p&gt;
&lt;p&gt;It's a great place to visit, but I wouldn't want to build my house there. Not when the lease can be revoked at any time.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;All my data is belong to me&lt;/strong&gt;. It makes no sense to put a third party in control of it. My photos: mine. My writings: mine. Why would I hand them over to a third party?&lt;/p&gt;
&lt;p&gt;I can understand the appeal of easy publishing to the general public - Facebook truly makes it easy for people to establish a presence and communicate. But for the more technically savvy, Facebook should be treated as a copy, not as the source. Data should be originated and owned elsewhere and channeled into Facebook. Write in your own blog. Post photos onto Flickr, with a local and web backup strategy. Funnel them into Facebook.&lt;/p&gt;
&lt;p&gt;That's a bit more like FriendFeed, which may be &lt;a href="http://scobleizer.com/2008/12/08/10-reasons-why-twitter-is-for-you-and-friendfeed-is-not/"&gt;why Scoble likes it so much&lt;/a&gt;.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Hackintosh Accomplished"</title><link href="https://www.parand.com/hackintosh-accomplished.html" rel="alternate"/><published>2009-01-25T10:00:00-08:00</published><updated>2009-01-25T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-01-25:/hackintosh-accomplished.html</id><summary type="html">&lt;p&gt;After 2 days of pain, finally a hackintosh is born. My advice to you if you're thinking of setting up a hackintosh: don't. Go buy a cheap mac instead.&lt;/p&gt;
&lt;p&gt;As I was fond of saying in the old days: Linux is free if your time is worthless. Hackintosh is about …&lt;/p&gt;</summary><content type="html">&lt;p&gt;After 2 days of pain, finally a hackintosh is born. My advice to you if you're thinking of setting up a hackintosh: don't. Go buy a cheap mac instead.&lt;/p&gt;
&lt;p&gt;As I was fond of saying in the old days: Linux is free if your time is worthless. Hackintosh is about the same.&lt;/p&gt;
&lt;p&gt;Having said that, I can confirm OS X 10.5.6 runs on a Toshiba A135-S4467 with most things working, with the exception of: sleep and wifi (so far). Things that do work: wired ethernet, USB, both external keyboard/mouse (with USB) and internal laptop keyboard/mouse, sound, and dual boot with Vista.&lt;/p&gt;
&lt;p&gt;I'll probably post the painful details at some point. In the meanwhile, I'm back on the mac. The things one does for the sake of the iPhone…&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Protect The Constitution Of The United States"</title><link href="https://www.parand.com/protect-the-constitution-of-the-united-states.html" rel="alternate"/><published>2009-01-20T10:00:00-08:00</published><updated>2009-01-20T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-01-20:/protect-the-constitution-of-the-united-states.html</id><summary type="html">&lt;p&gt;Inaugration day, and I missed just about all the festivities. One thing did stand out for me: the text of the &lt;a href="/web/20090201030654/http://en.wikipedia.org/wiki/Oath_of_office_of_the_President_of_the_United_States"&gt;Oath of the Office of the President&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;"I do solemnly swear that I will faithfully execute the Office of President of the United States, and will to the best …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Inaugration day, and I missed just about all the festivities. One thing did stand out for me: the text of the &lt;a href="/web/20090201030654/http://en.wikipedia.org/wiki/Oath_of_office_of_the_President_of_the_United_States"&gt;Oath of the Office of the President&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;"I do solemnly swear that I will faithfully execute the Office of President of the United States, and will to the best of my Ability, &lt;strong&gt;preserve, protect and defend the Constitution of the United States&lt;/strong&gt;."&lt;/p&gt;
&lt;p&gt;Preserve, protect, and defend the Constitution of the United States. Those founding fathers were smart.&lt;/p&gt;
&lt;p&gt;Here's hoping the new president takes the constitution more seriously than the last one and defends it instead of trying to diminish it.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Queueing Benefits"</title><link href="https://www.parand.com/queueing-benefits.html" rel="alternate"/><published>2009-01-19T10:00:00-08:00</published><updated>2009-01-19T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-01-19:/queueing-benefits.html</id><summary type="html">&lt;p&gt;Queues are nice things. We should be using more of them.&lt;/p&gt;
&lt;p&gt;A couple of benefits that I knew of but didn't really appreciate until Alex started using beanstalkd in his application:&lt;/p&gt;
&lt;p&gt;- Having a worker-pulls-jobs-from-queue model provides near optimal use of the machine and prevents overload and thrashing. Setup as many …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Queues are nice things. We should be using more of them.&lt;/p&gt;
&lt;p&gt;A couple of benefits that I knew of but didn't really appreciate until Alex started using beanstalkd in his application:&lt;/p&gt;
&lt;p&gt;- Having a worker-pulls-jobs-from-queue model provides near optimal use of the machine and prevents overload and thrashing. Setup as many simultaneous workers as your resources can handle and let them go. You have a controlled number of workers, preventing thrashing, and your workers work continuously. You don't have to worry about a load distribution strategy - workers pull jobs as fast as they can.&lt;/p&gt;
&lt;p&gt;- Provisioning new workers into the system becomes trivial. Want to add another box into the mix? Just set it up and have the workers start pulling jobs. You don't have to worry about registering the new box and getting it into the load distribution system - so long as it knows how to connect to the queue it can grab jobs. Alex commented that scaling his system is as easy as bringing up another virtual machine - as soon as it's up it starts pulling jobs.&lt;/p&gt;
&lt;p&gt;These are both very important operational benefits that I had largely ignored.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>Parandism: Two Man Job</title><link href="https://www.parand.com/parandism-two-man-job.html" rel="alternate"/><published>2009-01-13T10:00:00-08:00</published><updated>2009-01-13T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-01-13:/parandism-two-man-job.html</id><content type="html">&lt;hr&gt;
&lt;p&gt;Parand says:&lt;/p&gt;
&lt;p&gt;When attempting to do a two man job with only one man, substitute endurance for raw power.&lt;/p&gt;</content><category term="Quotes"/><category term="quote"/><category term="short"/></entry><entry><title>"San Diego Hadoop User Group Starting"</title><link href="https://www.parand.com/san-diego-hadoop-user-group-starting.html" rel="alternate"/><published>2009-01-04T10:00:00-08:00</published><updated>2009-01-04T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2009-01-04:/san-diego-hadoop-user-group-starting.html</id><content type="html">&lt;p&gt;We're starting a San Diego Hadoop User Group. Please send me an email ( darugar at gmail ) if you're interested or leave a comment here. Details to be worked out, but we'll likely will have the first meeting towards the end of February.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Obama Logo Design"</title><link href="https://www.parand.com/obama-logo-design.html" rel="alternate"/><published>2008-12-14T10:00:00-08:00</published><updated>2008-12-14T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-12-14:/obama-logo-design.html</id><content type="html">&lt;p&gt;Interesting video of &lt;a href="http://www.vsapartners.com/news.asp?article=70"&gt;how Obama's campaign logo was designed&lt;/a&gt;. Via &lt;a href="http://www.logodesignlove.com/obama-08-logo-design-options"&gt;LogoDesignLove&lt;/a&gt;.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Cloud Computing Hadoop Slides"</title><link href="https://www.parand.com/cloud-computing-hadoop-slides.html" rel="alternate"/><published>2008-11-20T10:00:00-08:00</published><updated>2008-11-20T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-11-20:/cloud-computing-hadoop-slides.html</id><content type="html">&lt;p&gt;Slides from my &lt;a href="http://dataservicesworld.sys-con.com/general/session1108.htm?id=95"&gt;Data Processing in the Cloud talk&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;a href="/web/20101222041425/http://www.slideshare.net/darugar/cloud-computing-hadoop-presentation?type=powerpoint"&gt;Cloud Computing: Hadoop&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;View SlideShare &lt;a href="http://www.slideshare.net/darugar/cloud-computing-hadoop-presentation?type=powerpoint"&gt;presentation&lt;/a&gt; or &lt;a href="/web/20101222041425/http://www.slideshare.net/upload?type=powerpoint"&gt;Upload&lt;/a&gt; your own. (tags: &lt;a href="/web/20101222041425/http://slideshare.net/tag/pig"&gt;pig&lt;/a&gt; &lt;a href="/web/20101222041425/http://slideshare.net/tag/cloud"&gt;cloud&lt;/a&gt;)&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Blogs Are Becoming Traditional Magazines"</title><link href="https://www.parand.com/blogs-are-becoming-traditional-magazines.html" rel="alternate"/><published>2008-11-18T10:00:00-08:00</published><updated>2008-11-18T10:00:00-08:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-11-18:/blogs-are-becoming-traditional-magazines.html</id><summary type="html">&lt;p&gt;Have you noticed how more and more the headlines of the top blogs are all the same announcement at the same time? Unfortunately we're going back to the PR-firm driven news reporting that was prevalent in the era of magazines, instead of that brief but wonderful time when bloggers actually …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Have you noticed how more and more the headlines of the top blogs are all the same announcement at the same time? Unfortunately we're going back to the PR-firm driven news reporting that was prevalent in the era of magazines, instead of that brief but wonderful time when bloggers actually thought for themselves and found stories of their own liking. At least magazines had standards related to grammar and some base level of fact checking, but oh well.&lt;/p&gt;
&lt;p&gt;On the bright side the blog world is wide and deep enough to provide lots of interesting news sources, even if they turn out not to be the top blogs.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Python Dot Notation Dictionary Access"</title><link href="https://www.parand.com/python-dot-notation-dictionary-access.html" rel="alternate"/><published>2008-10-24T10:00:00-07:00</published><updated>2008-10-24T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-24:/python-dot-notation-dictionary-access.html</id><summary type="html">&lt;p&gt;In most cases I prefer dot notation over bracket notation for dictionary access. That is, I prefer &lt;code&gt;mydictionary.myfield&lt;/code&gt; over &lt;code&gt;mydictionary\['myflield'\]&lt;/code&gt;. I also prefer attempted access to undefined keys to return None instead of raising an exception.&lt;/p&gt;
&lt;p&gt;With the help of &lt;a href="http://stackoverflow.com/questions/224026/javascript-style-dot-notation-for-dictionary-keys-unpythonic"&gt;this thread&lt;/a&gt;, this is what I've been using …&lt;/p&gt;</summary><content type="html">&lt;p&gt;In most cases I prefer dot notation over bracket notation for dictionary access. That is, I prefer &lt;code&gt;mydictionary.myfield&lt;/code&gt; over &lt;code&gt;mydictionary\['myflield'\]&lt;/code&gt;. I also prefer attempted access to undefined keys to return None instead of raising an exception.&lt;/p&gt;
&lt;p&gt;With the help of &lt;a href="http://stackoverflow.com/questions/224026/javascript-style-dot-notation-for-dictionary-keys-unpythonic"&gt;this thread&lt;/a&gt;, this is what I've been using:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="n"&gt;dotdict&lt;/span&gt;(&lt;span class="n"&gt;dict&lt;/span&gt;):
    &lt;span class="n"&gt;def&lt;/span&gt; &lt;span class="n"&gt;__getattr__&lt;/span&gt;(&lt;span class="nb"&gt;self&lt;/span&gt;, &lt;span class="n"&gt;attr&lt;/span&gt;):
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;.&lt;span class="nb"&gt;get&lt;/span&gt;(&lt;span class="n"&gt;attr&lt;/span&gt;, &lt;span class="n"&gt;None&lt;/span&gt;)
    &lt;span class="n"&gt;__setattr__&lt;/span&gt;= &lt;span class="n"&gt;dict&lt;/span&gt;.&lt;span class="n"&gt;__setitem__&lt;/span&gt;
    &lt;span class="n"&gt;__delattr__&lt;/span&gt;= &lt;span class="n"&gt;dict&lt;/span&gt;.&lt;span class="n"&gt;__delitem__&lt;/span&gt;

&amp;gt;&amp;gt;&amp;gt; &lt;span class="n"&gt;dd&lt;/span&gt; = &lt;span class="n"&gt;dotdict&lt;/span&gt;()
&amp;gt;&amp;gt;&amp;gt; &lt;span class="n"&gt;dd&lt;/span&gt;.&lt;span class="n"&gt;a&lt;/span&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;span class="n"&gt;dd&lt;/span&gt;.&lt;span class="n"&gt;a&lt;/span&gt; = &lt;span class="s"&gt;&amp;#39;one&amp;#39;&lt;/span&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;span class="n"&gt;dd&lt;/span&gt;.&lt;span class="n"&gt;a&lt;/span&gt;
&lt;span class="s"&gt;&amp;#39;one&amp;#39;&lt;/span&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;span class="n"&gt;dd&lt;/span&gt;.&lt;span class="nb"&gt;keys&lt;/span&gt;()
[&lt;span class="s"&gt;&amp;#39;a&amp;#39;&lt;/span&gt;]

&amp;gt;&amp;gt;&amp;gt; &lt;span class="n"&gt;existing&lt;/span&gt; = {&lt;span class="s"&gt;&amp;#39;a&amp;#39;&lt;/span&gt;:&lt;span class="s"&gt;&amp;#39;A&amp;#39;&lt;/span&gt;, &lt;span class="s"&gt;&amp;#39;b&amp;#39;&lt;/span&gt;:&lt;span class="s"&gt;&amp;#39;B&amp;#39;&lt;/span&gt;}
&amp;gt;&amp;gt;&amp;gt; &lt;span class="n"&gt;dot_existing&lt;/span&gt; = &lt;span class="n"&gt;dotdict&lt;/span&gt;(&lt;span class="n"&gt;existing&lt;/span&gt;)
&amp;gt;&amp;gt;&amp;gt; &lt;span class="n"&gt;dot_existing&lt;/span&gt;.&lt;span class="n"&gt;a&lt;/span&gt;
&lt;span class="s"&gt;&amp;#39;A&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"Python Scripts For Dumping Oracle Data And Loading Onto Hadoop DFS"</title><link href="https://www.parand.com/python-scripts-for-dumping-oracle-data-and-loading-onto-hadoop-dfs.html" rel="alternate"/><published>2008-10-22T10:00:00-07:00</published><updated>2008-10-22T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-22:/python-scripts-for-dumping-oracle-data-and-loading-onto-hadoop-dfs.html</id><summary type="html">&lt;p&gt;There have been several requests for this, so I might as well post it here for general use. I put together a simple system for dumping data out of Oracle databases and loading onto Hadoop DFS. The slightly interesting part is the parallelism - &lt;a href="http://pyprocessing.berlios.de/"&gt;Python's Processing library&lt;/a&gt; is used to dump …&lt;/p&gt;</summary><content type="html">&lt;p&gt;There have been several requests for this, so I might as well post it here for general use. I put together a simple system for dumping data out of Oracle databases and loading onto Hadoop DFS. The slightly interesting part is the parallelism - &lt;a href="http://pyprocessing.berlios.de/"&gt;Python's Processing library&lt;/a&gt; is used to dump partitions in parallel and copy and load them onto DFS in parallel. This helps when dumping large amounts of data from partitioned Oracle tables.&lt;/p&gt;
&lt;p&gt;The database interaction is handled by &lt;a href="http://parand.com/say/misc/db.py"&gt;db.py&lt;/a&gt; . There are a couple of helper functions for finding table partitions, etc. DBDumper dumps the requested fields from the requested table:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;dumper&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DBDumper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;username/password@yourhost:9999/DB&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;table_name&amp;#39;&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="s1"&gt;&amp;#39;field1&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;field2&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;field3&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;owner&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;partition&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;output_dir&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;dumper&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Where 10 is the level of concurrency, &lt;em&gt;owner&lt;/em&gt; is the owner of the table, and &lt;em&gt;partition&lt;/em&gt; is the name of the partitions you're interested in (can be None).&lt;/p&gt;
&lt;p&gt;&lt;a href="http://parand.com/say/misc/dfs.py"&gt;dfs.py&lt;/a&gt; copies the dumped files over in parallel, again using PyProcessing. It's simply a wrapper around "cat | ssh | hadoop dfs -put". &lt;/p&gt;
&lt;p&gt;DBDumper and dfs are tied together via a callback - when each partition is dumped, the callback is invoked, triggering the dfs copy. &lt;/p&gt;
&lt;p&gt;Here's a complete example of using these to dump and copy data:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;db&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;dfs&lt;/span&gt;

&lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;dfs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RemoteDFS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;address.of.remote.machine&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;cp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;CALLBACK:&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;arg&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arg&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="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/some/directory/&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;arg&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="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;arg&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="n"&gt;dumper&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DBDumper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;username/password@yourhost:9999/DB&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;table_name&amp;#39;&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="s1"&gt;&amp;#39;field1&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;field2&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;field3&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;owner&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;partition&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;output_dir&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;dumper&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"GMail Contact Groups: Add By Tag / Search"</title><link href="https://www.parand.com/gmail-contact-groups-add-by-tag-search.html" rel="alternate"/><published>2008-10-20T10:00:00-07:00</published><updated>2008-10-20T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-20:/gmail-contact-groups-add-by-tag-search.html</id><summary type="html">&lt;p&gt;I'm trying to setup ad-hoc small mailing lists using GMail. They have a contact groups feature that mostly does what I need. However, the interface for adding contacts is quite limited - you pick from a list.&lt;/p&gt;
&lt;p&gt;It'd make a lot more sense to allow addition of contacts to groups based …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I'm trying to setup ad-hoc small mailing lists using GMail. They have a contact groups feature that mostly does what I need. However, the interface for adding contacts is quite limited - you pick from a list.&lt;/p&gt;
&lt;p&gt;It'd make a lot more sense to allow addition of contacts to groups based on searching - eg. look for everyone labeled "tester" and add them to the "tester" contact group en-masse, or for any message containing the term "paintball" and add all the senders/recipients to "paintballers" group.&lt;/p&gt;
&lt;p&gt;So there you go GMail group, please get to work.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"RESTful URL Design For Search And Collections"</title><link href="https://www.parand.com/restful-url-design-for-search-and-collections.html" rel="alternate"/><published>2008-10-16T10:00:00-07:00</published><updated>2008-10-16T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-16:/restful-url-design-for-search-and-collections.html</id><summary type="html">&lt;p&gt;I'm trying to find the appropriate design for RESTful design of URLs for search and for collections of items.&lt;/p&gt;
&lt;p&gt;The setup: we have two models, Cars and Garages, where Cars can be in Garages. Base URLs:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;/car/xxx           (xxx = car id)
/garage/yyy     (yyy = garage id)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now we want to …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I'm trying to find the appropriate design for RESTful design of URLs for search and for collections of items.&lt;/p&gt;
&lt;p&gt;The setup: we have two models, Cars and Garages, where Cars can be in Garages. Base URLs:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;/car/xxx           (xxx = car id)
/garage/yyy     (yyy = garage id)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now we want to provide a search for cars - eg. show me all the blue sedans with 4 doors. What's the appropriate URL?&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;1&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cars&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;blue&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;sedan&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;doors&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;4&lt;/span&gt;
&lt;span class="mf"&gt;2&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cars&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;blue&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;sedan&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;doors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;4&lt;/span&gt;
&lt;span class="mf"&gt;3&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cars&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="err"&gt;?&lt;/span&gt;&lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;blue&lt;/span&gt;&lt;span class="err"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;sedan&lt;/span&gt;&lt;span class="err"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;doors&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;4&lt;/span&gt;
&lt;span class="mf"&gt;4&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;car&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;None of these are satisfying.&lt;/p&gt;
&lt;p&gt;1 through 3 use "cars" as the base (as opposed to "car"). So the pattern for doing searches / collections would be to pluralize the model. This seems ok.&lt;/p&gt;
&lt;p&gt;1 has arbitrary ordering of the fields and no good way to distinguish fields versus their values. 2 is slightly better, but still doesn't seem right.&lt;/p&gt;
&lt;p&gt;3 uses the QUERYSTRING for the parameters instead of the PATHINFO, and frankly looks better to me, but I've heard of objections to using QUERYSTRING. The problem I have with it is it's not consistent - if I was searching on a single field my URL would probably be: &lt;code&gt;/cars/color/red&lt;/code&gt; or something like that. Having the URL drastically change form just because there are more search parameters seems wrong.&lt;/p&gt;
&lt;p&gt;4 uses the "car" base url along with the verb "search". That seems wrong - verbs shouldn't be part of the URL, right? It's been suggested several times though.&lt;/p&gt;
&lt;p&gt;Now a slightly different case - let's find all the cars in a given garage:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;1&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;garage&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;yyy&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cars&lt;/span&gt;
&lt;span class="mf"&gt;2&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;cars&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="err"&gt;?&lt;/span&gt;&lt;span class="n"&gt;garage&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;yyy&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;1 seems pretty good in this case.&lt;/p&gt;
&lt;p&gt;Please chime in with your thoughts, either in the comments here or in the &lt;a href="http://stackoverflow.com/questions/207477/restful-url-design-for-search"&gt;Stackoverflow thread&lt;/a&gt;.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Yahoo Live Surprisingly Good"</title><link href="https://www.parand.com/yahoo-live-surprisingly-good.html" rel="alternate"/><published>2008-10-16T10:00:00-07:00</published><updated>2008-10-16T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-16:/yahoo-live-surprisingly-good.html</id><summary type="html">&lt;p&gt;&lt;img alt="" src="http://parand.com/say/misc/hacku-live-40.png"&gt;&lt;/p&gt;
&lt;p&gt;I'm using Yahoo Live to get a look at the &lt;a href="http://live.yahoo.com/hacku"&gt;Yahoo UCSD Hack Day event&lt;/a&gt;, and I'm quite surprised at how well it works.&lt;/p&gt;
&lt;p&gt;Seeing someone's face via their webcam is an absolute waste of time, particularly on on video conference calls, but here I'm looking at a view of …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="" src="http://parand.com/say/misc/hacku-live-40.png"&gt;&lt;/p&gt;
&lt;p&gt;I'm using Yahoo Live to get a look at the &lt;a href="http://live.yahoo.com/hacku"&gt;Yahoo UCSD Hack Day event&lt;/a&gt;, and I'm quite surprised at how well it works.&lt;/p&gt;
&lt;p&gt;Seeing someone's face via their webcam is an absolute waste of time, particularly on on video conference calls, but here I'm looking at a view of the room in the larger window, and at several of the hackers in smaller windows. This is actually a pretty workable virtual office. I can see &lt;a href="http://paulisageek.blogspot.com/"&gt;Paul&lt;/a&gt; eating Pizza, &lt;a href="http://lerdorf.com/"&gt;Rasmus&lt;/a&gt; helping people, and the group I was sitting with mostly still there. I half feel like driving back over and re-joining the group.&lt;/p&gt;
&lt;p&gt;Why is this useful? Well, for one, I can see people working, and it motivates me to stay up and work. Compare this to having no communication, just email, or IRC, and you'll see it provides a much more tactile, real-world feel. I can see and hear the activity.&lt;/p&gt;
&lt;p&gt;I could actually imagine a technology like this being useful for virtual office. Kind of like hanging out on IRC/IM, but with a more human feel.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Fremium Works If You Do It Right"</title><link href="https://www.parand.com/fremium-works-if-you-do-it-right.html" rel="alternate"/><published>2008-10-15T10:00:00-07:00</published><updated>2008-10-15T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-15:/fremium-works-if-you-do-it-right.html</id><summary type="html">&lt;p&gt;&lt;img alt="" src="http://l.yimg.com/g/images/flickr_logo_gamma.gif.v59899.14"&gt;&lt;/p&gt;
&lt;p&gt;I am an &lt;del&gt;incredibly cheap bastard&lt;/del&gt; frugal. I don't like to pay for things.&lt;/p&gt;
&lt;p&gt;Yet I just paid for Flickr without hesitation or a moment of doubt. Odd.&lt;/p&gt;
&lt;p&gt;Here's why, I think:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cheap&lt;/strong&gt;: $25/year is not a lot of money.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Excellent service&lt;/strong&gt;. I've never had a problem with the …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="" src="http://l.yimg.com/g/images/flickr_logo_gamma.gif.v59899.14"&gt;&lt;/p&gt;
&lt;p&gt;I am an &lt;del&gt;incredibly cheap bastard&lt;/del&gt; frugal. I don't like to pay for things.&lt;/p&gt;
&lt;p&gt;Yet I just paid for Flickr without hesitation or a moment of doubt. Odd.&lt;/p&gt;
&lt;p&gt;Here's why, I think:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cheap&lt;/strong&gt;: $25/year is not a lot of money.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Excellent service&lt;/strong&gt;. I've never had a problem with the service; they're always available and fast.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Nice, easy to use product&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Trust&lt;/strong&gt;. I trust that Flickr won't do anything bad with my account, with my photos, with my credit card, or with anything else. I trust them because I believe they respect their customers: &lt;/li&gt;
&lt;li&gt;They don't automatically charge renewals your account - you have to take an action each time you have to pay them, so you know they're not going behind your back to charge your credit card.&lt;/li&gt;
&lt;li&gt;If you decide not to pay, they still provide a reasonable product (only your most recent 200 photos are available) instead of leaving you high and dry. If you decide to pay at a later time you get your full account back.&lt;/li&gt;
&lt;li&gt;They provide full, easy access to all your data via a variety of APIs and tools at all times. They're not trying to tie you down by trapping your data.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I feel comfortable spending money on Flickr in the same way I feel comfortable spending at Costco - I feel they'll make things right for me without giving me a lot of trouble. So I spend.&lt;/p&gt;
&lt;p&gt;This is the way to build a sustainable fremium business - make gaining your customer's trust your top priority.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Python Script For Finding And Removing Duplicate Files"</title><link href="https://www.parand.com/python-script-for-finding-and-removing-duplicate-files.html" rel="alternate"/><published>2008-10-15T10:00:00-07:00</published><updated>2008-10-15T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-15:/python-script-for-finding-and-removing-duplicate-files.html</id><summary type="html">&lt;p&gt;My image, mp3, and ebook collection were a mess after years of copying to various servers, consolidating, and re-copying. I had lots of duplicates.&lt;/p&gt;
&lt;p&gt;I looked for an app to find and remove duplicates but surprisingly didn't find anything very good. So I had to write my own.&lt;/p&gt;
&lt;p&gt;This is …&lt;/p&gt;</summary><content type="html">&lt;p&gt;My image, mp3, and ebook collection were a mess after years of copying to various servers, consolidating, and re-copying. I had lots of duplicates.&lt;/p&gt;
&lt;p&gt;I looked for an app to find and remove duplicates but surprisingly didn't find anything very good. So I had to write my own.&lt;/p&gt;
&lt;p&gt;This is a very simple script - it scans the directory tree you specify, looks for exact duplicates, and removes the duplicates.&lt;/p&gt;
&lt;p&gt;It's not very smart about which copy it removes. It's not smart about finding files that are "similar" - it only finds exact matches. It ignores small files (intentionally - it's easy to make it deal with small files).&lt;/p&gt;
&lt;p&gt;It uses /temp for its output and cache files, so it's targeting windows. Change that to /tmp if you're running unix.&lt;/p&gt;
&lt;p&gt;I built in a caching mechanism to save the results of scanning the disk, but it turned out not to be too useful and the script ran faster than I expected, so the caching is commented out.&lt;/p&gt;
&lt;p&gt;Here it is: &lt;a href="http://parand.com/say/misc/FileInfo.py"&gt;FileInfo.py&lt;/a&gt; .&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Small Biz Minimal CRM Thoughts"</title><link href="https://www.parand.com/small-biz-minimal-crm-thoughts.html" rel="alternate"/><published>2008-10-15T10:00:00-07:00</published><updated>2008-10-15T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-15:/small-biz-minimal-crm-thoughts.html</id><summary type="html">&lt;p&gt;&lt;img alt="" src="http://farm1.static.flickr.com/23/27707355_3c3adbb40a_m_d.jpg"&gt;&lt;/p&gt;
&lt;p&gt;As the "computer guy" for my wife, various friends, and my own activities, I often see a need for a very simple "CRM" system. But it's not really CRM; it's more of a contact management system together with a way to send emails to various groups of friends / customers, a …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="" src="http://farm1.static.flickr.com/23/27707355_3c3adbb40a_m_d.jpg"&gt;&lt;/p&gt;
&lt;p&gt;As the "computer guy" for my wife, various friends, and my own activities, I often see a need for a very simple "CRM" system. But it's not really CRM; it's more of a contact management system together with a way to send emails to various groups of friends / customers, a way to catalog past exchanges, and perhaps a simple to-do system.&lt;/p&gt;
&lt;p&gt;Periodically I look at the various available options (there are many), give one or more of them a try, and give up, generally because they're too complex and too capable.&lt;/p&gt;
&lt;p&gt;The most promising is &lt;a href="http://www.highrisehq.com/"&gt;High Rise&lt;/a&gt;, but I don't think it provides a way to send emails, so it doesn't qualify.&lt;/p&gt;
&lt;p&gt;Here are my requirements for my imaginary Pony CRM:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Simple&lt;/strong&gt;. Must be simple enough that my wife will actually use it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Integration with Yahoo Mail / GMail&lt;/strong&gt;. This should be generalized to POP/IMAP integration, but I find almost everyone uses one of the large providers, either Yahoo or Gmail.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Automatic synchronization with Yahoo/Gmail&lt;/strong&gt;. There shouldn't be an "import" option - it should always be sync'd automatically. A contact in Gmail should be immediately available in Pony CRM, and vice versa.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Easy cataloging / collection of emails&lt;/strong&gt;. It'd be good to be able to catalog and tag email exchanges.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Easy mass email&lt;/strong&gt;. This is the most important feature - without exception, the most common use case is: I want to email a subset of contacts and I want to track who replied, looked at what I sent, etc. For example, all of your clients that have certain investments, or all customers who've requested feature X, all customers who signed up before date X, and so forth, should receive a nice email.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Easy graphical email composition&lt;/strong&gt;. Everyone wants to send a nicely formated email with graphics that's readable in the majority of email readers, but no one can figure out how. This should be built in to the CRM tool in some way. There should be a way to store the email templates for future use.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;History and Audit Trails&lt;/strong&gt;. You should be able to figure out who you sent what to, when.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Extensibility&lt;/strong&gt;. APIs for access to the CRM system as well as a way to integrate external feeds/ APIs/ widgets into the CRM system.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Free/Cheap Hosting with Simple Full Export&lt;/strong&gt;. If it's cheap enough, I can push everyone to pay the monthly fee and get the support issue off of my back. However, there must be a simple full-export option as well as an alternative means of using the exported data - eg. an open source version that could be deployed should the hosted version go out of business. Can't have lock-in if your business depends on the data.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I think this covers just about everything needed. Someone please either build or point me to Pony CRM so I can be happy.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Access Python Dictionary Keys As Properties"</title><link href="https://www.parand.com/access-python-dictionary-keys-as-properties.html" rel="alternate"/><published>2008-10-13T10:00:00-07:00</published><updated>2008-10-13T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-13:/access-python-dictionary-keys-as-properties.html</id><summary type="html">&lt;p&gt;Say you want to access the values if your dictionary via the dot notation instead of the dictionary syntax. That is, you have:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;d = {&amp;#39;name&amp;#39;:&amp;#39;Joe&amp;#39;, &amp;#39;mood&amp;#39;:&amp;#39;grumpy&amp;#39;}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And you want to get at "name" and "mood" via &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;d.name
d.mood
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;instead of the usual &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;d[&amp;#39;name&amp;#39;]
d[&amp;#39;mood …&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;Say you want to access the values if your dictionary via the dot notation instead of the dictionary syntax. That is, you have:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;d = {&amp;#39;name&amp;#39;:&amp;#39;Joe&amp;#39;, &amp;#39;mood&amp;#39;:&amp;#39;grumpy&amp;#39;}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And you want to get at "name" and "mood" via &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;d.name
d.mood
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;instead of the usual &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;d[&amp;#39;name&amp;#39;]
d[&amp;#39;mood&amp;#39;]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Why would you want to do this? Maybe you're fond of the Javascript Way. Or you find it more aesthetic. In my case I need to have the same piece of code deal with items that are either instances of Django models or plain dictionaries, so I need to provide a uniform way of getting at the attributes. &lt;/p&gt;
&lt;p&gt;Turns out it's pretty simple: &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="n"&gt;DictObj&lt;/span&gt;(&lt;span class="n"&gt;object&lt;/span&gt;):
    &lt;span class="n"&gt;def&lt;/span&gt; &lt;span class="n"&gt;__init__&lt;/span&gt;(&lt;span class="nb"&gt;self&lt;/span&gt;, &lt;span class="nb"&gt;d&lt;/span&gt;):
        &lt;span class="nb"&gt;self&lt;/span&gt;.&lt;span class="nb"&gt;d&lt;/span&gt; = &lt;span class="nb"&gt;d&lt;/span&gt;

    &lt;span class="n"&gt;def&lt;/span&gt; &lt;span class="n"&gt;__getattr__&lt;/span&gt;(&lt;span class="nb"&gt;self&lt;/span&gt;, &lt;span class="sr"&gt;m):&lt;/span&gt;
&lt;span class="sr"&gt;        return self.d.get(m, None)&lt;/span&gt;

&lt;span class="nb"&gt;d&lt;/span&gt; = &lt;span class="n"&gt;DictObj&lt;/span&gt;(&lt;span class="nb"&gt;d&lt;/span&gt;)
&lt;span class="nb"&gt;d&lt;/span&gt;.&lt;span class="nb"&gt;name&lt;/span&gt;
&lt;span class="c1"&gt;# prints Joe&lt;/span&gt;
&lt;span class="nb"&gt;d&lt;/span&gt;.&lt;span class="n"&gt;mood&lt;/span&gt;
&lt;span class="c1"&gt;# prints grumpy&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"Beanstalkd / Python Basic Tutorial"</title><link href="https://www.parand.com/beanstalkd-python-basic-tutorial.html" rel="alternate"/><published>2008-10-12T10:00:00-07:00</published><updated>2008-10-12T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-12:/beanstalkd-python-basic-tutorial.html</id><summary type="html">&lt;p&gt;(First &lt;a href="/say/index.php/2008/10/12/setting-up-beanstalkd-on-ubuntu-for-python.html"&gt;install beanstalkd and pybeanstalk&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Beanstalkd is an in-memory queuing system. It supports named queues (called 'tubes'), priorities, and delayed delivery of messages.&lt;/p&gt;
&lt;p&gt;Terminology: a message is called a &lt;em&gt;job&lt;/em&gt;, and queues are called &lt;em&gt;tubes&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Let's look at an example scenario. Say you want to create 2 tubes, one called …&lt;/p&gt;</summary><content type="html">&lt;p&gt;(First &lt;a href="/say/index.php/2008/10/12/setting-up-beanstalkd-on-ubuntu-for-python.html"&gt;install beanstalkd and pybeanstalk&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Beanstalkd is an in-memory queuing system. It supports named queues (called 'tubes'), priorities, and delayed delivery of messages.&lt;/p&gt;
&lt;p&gt;Terminology: a message is called a &lt;em&gt;job&lt;/em&gt;, and queues are called &lt;em&gt;tubes&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Let's look at an example scenario. Say you want to create 2 tubes, one called "orders" and another called "emails", place orders into the first tube (or queue) and emails into the second, and have different processes handle orders and emails.&lt;/p&gt;
&lt;p&gt;You can create queues by simply naming and putting messages into them. On the producer side:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;beanstalk&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;serverconn&lt;/span&gt;
&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;serverconn&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ServerConn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;localhost&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;99988&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# put a message (or job) into the default queue:&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;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;first message, into default tube&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# now start using a named tube:&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;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;orders&amp;#39;&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;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;second message, into orders tube&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now on the consumer:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;beanstalk&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;serverconn&lt;/span&gt;
&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;serverconn&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ServerConn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;localhost&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;99988&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# by default your connection will be listening on the &amp;#39;default&amp;#39; tube.&lt;/span&gt;
&lt;span class="c1"&gt;# switch it to use the &amp;#39;orders&amp;#39; tube.&lt;/span&gt;
&lt;span class="c1"&gt;# This should return the &amp;#39;orders&amp;#39; message and ignore the &amp;#39;default&amp;#39; message:&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;watchlist&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;orders&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&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;reserve&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;j&lt;/span&gt;
&lt;span class="c1"&gt;# {&amp;#39;data&amp;#39;: &amp;#39;second message, into orders tube&amp;#39;, &amp;#39;jid&amp;#39;: 39, &amp;#39;bytes&amp;#39;: 32, &amp;#39;state&amp;#39;: &amp;#39;ok&amp;#39;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You can similarly setup another consumer to listen on only the 'emails' tube, or both, or any other scenario you want.&lt;/p&gt;
&lt;p&gt;Beanstalkd also supports priorities, with 0 being highest priority and higher numbers meaning lower priority. You define message priority with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;c.put(&amp;#39;low priority message&amp;#39;, pri=999 )
c.put(&amp;#39;high priority message&amp;#39;, pri=0 )

j = c.reserve()
print j
# {&amp;#39;data&amp;#39;: &amp;#39;high priority message&amp;#39;, &amp;#39;jid&amp;#39;: 41, &amp;#39;bytes&amp;#39;: 21, &amp;#39;state&amp;#39;: &amp;#39;ok&amp;#39;}
# the high priority message was delivered before the low priority message, even
# though the low priority message was first into the queue
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The beanstalkd consumption model is to "reserve" a message (or job), process it, and then tell beanstalkd you've successfully dealt with the message so it can be thrown away. When you first get the job via c.reserve() you haven't actually fully consumed it; you've just reserved it for processing.&lt;/p&gt;
&lt;p&gt;What does this mean? Imagine a scenario where you reserve a message but your process dies before you have a chance to fully process it. Beanstalkd holds your message in reserve for a period of time, but since it hasn't heard from you confirming you've successfully dealt with the message, it eventually removes the reservation and makes the message available once again for the next consumer to grab. This is a basic handshake between the consumer and the server to allow for some level of resiliency.&lt;/p&gt;
&lt;p&gt;So once you're finished dealing with the message you've reserved, be sure to "delete" it, letting the beanstalkd server know it can throw that message away:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nv"&gt;j&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;c&lt;/span&gt;.&lt;span class="nv"&gt;reserve&lt;/span&gt;&lt;span class="ss"&gt;()&lt;/span&gt;
#&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;do&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;some&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;processing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;with&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;j&lt;/span&gt;
&lt;span class="nv"&gt;c&lt;/span&gt;.&lt;span class="nv"&gt;delete&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;j&lt;/span&gt;[&lt;span class="s1"&gt;&amp;#39;jid&amp;#39;&lt;/span&gt;]&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So there you have the basics. Let me know if you're interested and I can cover a few more topics.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Setting Up Beanstalkd on Ubuntu for Python"</title><link href="https://www.parand.com/setting-up-beanstalkd-on-ubuntu-for-python.html" rel="alternate"/><published>2008-10-12T10:00:00-07:00</published><updated>2008-10-12T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-12:/setting-up-beanstalkd-on-ubuntu-for-python.html</id><summary type="html">&lt;p&gt;&lt;a href="http://xph.us/software/beanstalkd/"&gt;beanstalkd&lt;/a&gt; is a promising in-memory queuing system in the mold of memcached (minimal configuration, just works) with client libraries in a variety of languages. The following worked for me for installing it on Ubuntu 8.04:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;mkdir&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="n"&gt;packages&lt;/span&gt;

&lt;span class="c1"&gt;# pre-requisite: libevent.&lt;/span&gt;
&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="n"&gt;packages&lt;/span&gt;
&lt;span class="n"&gt;wget&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;monkey&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;/~&lt;/span&gt;&lt;span class="n"&gt;provos&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libevent&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;1.4 …&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;&lt;a href="http://xph.us/software/beanstalkd/"&gt;beanstalkd&lt;/a&gt; is a promising in-memory queuing system in the mold of memcached (minimal configuration, just works) with client libraries in a variety of languages. The following worked for me for installing it on Ubuntu 8.04:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;mkdir&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="n"&gt;packages&lt;/span&gt;

&lt;span class="c1"&gt;# pre-requisite: libevent.&lt;/span&gt;
&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="n"&gt;packages&lt;/span&gt;
&lt;span class="n"&gt;wget&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;monkey&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;/~&lt;/span&gt;&lt;span class="n"&gt;provos&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libevent&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;1.4&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;stable&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tar&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gz&lt;/span&gt;
&lt;span class="n"&gt;tar&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;zxvf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;monkey&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;/~&lt;/span&gt;&lt;span class="n"&gt;provos&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libevent&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;1.4&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;stable&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tar&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gz&lt;/span&gt;
&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;libevent&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;1.4&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;stable&lt;/span&gt;
&lt;span class="o"&gt;./&lt;/span&gt;&lt;span class="n"&gt;configure&lt;/span&gt;
&lt;span class="n"&gt;make&lt;/span&gt;
&lt;span class="n"&gt;sudo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;install&lt;/span&gt;

&lt;span class="c1"&gt;# add /usr/local/lib to your load library path so beanstalkd can find libevent&lt;/span&gt;
&lt;span class="n"&gt;vi&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~/.&lt;/span&gt;&lt;span class="n"&gt;bashrc&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;following&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;somewhere&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;near&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;LD_LIBRARY_PATH&lt;/span&gt;&lt;span class="o"&gt;=$&lt;/span&gt;&lt;span class="n"&gt;LD_LIBRYARY_PATH&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;usr&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;local&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;lib&lt;/span&gt;

&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;vi&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;source&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~/.&lt;/span&gt;&lt;span class="n"&gt;bashrc&lt;/span&gt;

&lt;span class="c1"&gt;# need git in order to get latest code for beanstalkd&lt;/span&gt;
&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="n"&gt;packages&lt;/span&gt;
&lt;span class="n"&gt;sudo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;apt&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;git&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;core&lt;/span&gt;

&lt;span class="c1"&gt;# grab beanstalkd&lt;/span&gt;
&lt;span class="n"&gt;git&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;clone&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;xph&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;us&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;beanstalkd&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;git&lt;/span&gt;
&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;beanstalkd&lt;/span&gt;
&lt;span class="n"&gt;make&lt;/span&gt;

&lt;span class="c1"&gt;# now you should be able to start the beanstalkd daemon&lt;/span&gt;
&lt;span class="o"&gt;./&lt;/span&gt;&lt;span class="n"&gt;beanstalkd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;99988&lt;/span&gt;

&lt;span class="c1"&gt;# get the python beanstalkd client&lt;/span&gt;
&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="n"&gt;packages&lt;/span&gt;
&lt;span class="n"&gt;svn&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;checkout&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;pybeanstalk&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;googlecode&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;svn&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trunk&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;pybeanstalk&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;only&lt;/span&gt;

&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;pybeanstalk&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;only&lt;/span&gt;
&lt;span class="n"&gt;sudo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;setup&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;install&lt;/span&gt;

&lt;span class="c1"&gt;# get pyyaml, a pre-requisite for the python beanstalkd client&lt;/span&gt;
&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="n"&gt;packages&lt;/span&gt;
&lt;span class="n"&gt;wget&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;pyyaml&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;download&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;pyyaml&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;PyYAML&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;3.06&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tar&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gz&lt;/span&gt;
&lt;span class="n"&gt;tar&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;zxvf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;PyYAML&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;3.06&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tar&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gz&lt;/span&gt;
&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;PyYAML&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;3.06&lt;/span&gt;
&lt;span class="n"&gt;sudo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;setup&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;install&lt;/span&gt;

&lt;span class="c1"&gt;# open two different shells (or use screen) type the following in the two different shells:&lt;/span&gt;
&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;~/&lt;/span&gt;&lt;span class="n"&gt;packages&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;pybeanstalk&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;only&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;examples&lt;/span&gt;
&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;simple_clients&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;producer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;localhost&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;99988&lt;/span&gt;
&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;simple_clients&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;consumer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;localhost&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;99988&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"UCSD Hack Week: I’ll Be There"</title><link href="https://www.parand.com/ucsd-hack-week-ill-be-there.html" rel="alternate"/><published>2008-10-12T10:00:00-07:00</published><updated>2008-10-12T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-12:/ucsd-hack-week-ill-be-there.html</id><summary type="html">&lt;p&gt;I'm participating in the UCSD Yahoo Hack U week this coming week (Oct 13th-17th) with a talk on Wed and hopefully sticking around through most of the actual hack day (Thurs/Fri). If you're going to be on campus let me know by emailing me ( darugar at gmail ) or leaving …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I'm participating in the UCSD Yahoo Hack U week this coming week (Oct 13th-17th) with a talk on Wed and hopefully sticking around through most of the actual hack day (Thurs/Fri). If you're going to be on campus let me know by emailing me ( darugar at gmail ) or leaving a comment below.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Back Up No More?"</title><link href="https://www.parand.com/back-up-no-more.html" rel="alternate"/><published>2008-10-10T10:00:00-07:00</published><updated>2008-10-10T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-10:/back-up-no-more.html</id><summary type="html">&lt;p&gt;My laptop suddenly stopped working, throwing me into panic - what if it's a problem with the motherboard, the same problem that killed my last laptop?&lt;/p&gt;
&lt;p&gt;It turned out to be the power adapter, fairly easily remedied, but it got me thinking about backups.&lt;/p&gt;
&lt;p&gt;I realized I actually don't have a …&lt;/p&gt;</summary><content type="html">&lt;p&gt;My laptop suddenly stopped working, throwing me into panic - what if it's a problem with the motherboard, the same problem that killed my last laptop?&lt;/p&gt;
&lt;p&gt;It turned out to be the power adapter, fairly easily remedied, but it got me thinking about backups.&lt;/p&gt;
&lt;p&gt;I realized I actually don't have a lot to backup. All of my important work stuff is already under version control, available from another server. Losing my pictures would suck, but the majority of the ones I like I've already put on Flickr.&lt;/p&gt;
&lt;p&gt;My email is already on gmail and Yahoo mail, as are my contacts and calendar. My personal documents are mostly on Google docs, and the others are available from various servers here and there.&lt;/p&gt;
&lt;p&gt;Just about everything I do is already in the cloud. Which makes it very nice - practically speaking, if I had to rebuild my working environment the majority of the effort would go into setting up the various development tools instead of recovering things from backup.&lt;/p&gt;
&lt;p&gt;Quite nice, and quite different from 5 years ago.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Thankful For The Stupidity of Virus Authors"</title><link href="https://www.parand.com/thankful-for-the-stupidity-of-virus-authors.html" rel="alternate"/><published>2008-10-10T10:00:00-07:00</published><updated>2008-10-10T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-10:/thankful-for-the-stupidity-of-virus-authors.html</id><summary type="html">&lt;p&gt;For about a week now the network at home has been slow. Just as I'd get frustrated enough to do something about it it'd get fast again, so I procrastinated.&lt;/p&gt;
&lt;p&gt;Meanwhile I was cursing Time Warner, Linksys, Apple, and just about everybody else whose hardware I own. The Linksys wireless …&lt;/p&gt;</summary><content type="html">&lt;p&gt;For about a week now the network at home has been slow. Just as I'd get frustrated enough to do something about it it'd get fast again, so I procrastinated.&lt;/p&gt;
&lt;p&gt;Meanwhile I was cursing Time Warner, Linksys, Apple, and just about everybody else whose hardware I own. The Linksys wireless router is 5 years old, but come on, it should still work!&lt;/p&gt;
&lt;p&gt;This morning my wife complained of web access on the desktop being slow, so I sat down to take a look. Sure enough, very slow. It was odd that the computer itself wasn't as responsive as it used to be, but then it is a windows box, so curse Microsoft.&lt;/p&gt;
&lt;p&gt;As I was dialing Time Warner to schedule someone to come out and take a look I started to look for a bandwidth tester so I could prove how crappy their service was. Oddly the search results didn't actually go to a bandwidth meter, but rather to an intermediary page with lots of links to bandwidth meters.&lt;/p&gt;
&lt;p&gt;And that's when I realized: I gots me a virus. Fantastic. It's sitting there eating my bandwidth, probably spamming the world.&lt;/p&gt;
&lt;p&gt;Point is, I was ready to blame everyone in the world instead of thinking it's a virus. If the virus authors hadn't put in the search redirection they could've probably lived on for another month sending their merry spam.&lt;/p&gt;
&lt;p&gt;I'm certain a clever virus could infect a very large percentage of the world's computers without anyone noticing. Probably already has.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Stackoverflow: Surprisingly Good Source of Technical Answers"</title><link href="https://www.parand.com/stackoverflow-surprisingly-good-source-of-technical-answers.html" rel="alternate"/><published>2008-10-09T10:00:00-07:00</published><updated>2008-10-09T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-09:/stackoverflow-surprisingly-good-source-of-technical-answers.html</id><summary type="html">&lt;p&gt;&lt;img alt="Stackoverflow Logo" src="http://stackoverflow.com/Content/Img/stackoverflow-logo-250.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://stackoverflow.com/"&gt;Stackoverflow&lt;/a&gt; is a newish service for developers - ask a question, get answers, vote on answers, build reputation. Sort of like Yahoo! Answers but for developers.&lt;/p&gt;
&lt;p&gt;I'm surprised at how good the service is so far. I asked a question on IRC and the same question on Stackoverflow. Within 2 minutes …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="Stackoverflow Logo" src="http://stackoverflow.com/Content/Img/stackoverflow-logo-250.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://stackoverflow.com/"&gt;Stackoverflow&lt;/a&gt; is a newish service for developers - ask a question, get answers, vote on answers, build reputation. Sort of like Yahoo! Answers but for developers.&lt;/p&gt;
&lt;p&gt;I'm surprised at how good the service is so far. I asked a question on IRC and the same question on Stackoverflow. Within 2 minutes I got an incorrect answer on IRC and the two correct answers on Stackoverflow. The voting and reputation seems to really work and there's no IRC trolls / egos to deal with.&lt;/p&gt;
&lt;p&gt;I'm hoping the site will maintain its usefulness as it grows. Well worth checking out. I'm &lt;a href="http://stackoverflow.com/users/13055/parand"&gt;here&lt;/a&gt;.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"The Big Picture Adopts ReaderScroll Navigation"</title><link href="https://www.parand.com/the-big-picture-adopts-readerscroll-navigation.html" rel="alternate"/><published>2008-10-07T10:00:00-07:00</published><updated>2008-10-07T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-07:/the-big-picture-adopts-readerscroll-navigation.html</id><summary type="html">&lt;p&gt;This is an excellent development - &lt;a href="http://www.boston.com/bigpicture/"&gt;The Big Picture&lt;/a&gt; from boston.com, a beautiful photo blog and one of the big reasons for putting ReaderScroll together, has &lt;a href="http://www.boston.com/bigpicture/2008/10/a_quick_note_1.html"&gt;implemented j/k navigation, inspired by ReaderScroll&lt;/a&gt;. Nicely done - now you can navigate the pictures via the j/k keys.&lt;/p&gt;
&lt;p&gt;One down, many more …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This is an excellent development - &lt;a href="http://www.boston.com/bigpicture/"&gt;The Big Picture&lt;/a&gt; from boston.com, a beautiful photo blog and one of the big reasons for putting ReaderScroll together, has &lt;a href="http://www.boston.com/bigpicture/2008/10/a_quick_note_1.html"&gt;implemented j/k navigation, inspired by ReaderScroll&lt;/a&gt;. Nicely done - now you can navigate the pictures via the j/k keys.&lt;/p&gt;
&lt;p&gt;One down, many more to go. First step towards &lt;a href="/say/index.php/2006/12/08/google-reader-interface-everywhere.html"&gt;j/k navigation everywhere&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Btw, several people have pointed out vi used j/k navigation before Google Reader. True enough. j/k was also used in very old keyboard based games. However, the use of j/k to center web content was first brought to my attention in Google Reader, so I'm sticking with "Google Reader Style" instead of "vi style".&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Depressed"</title><link href="https://www.parand.com/depressed.html" rel="alternate"/><published>2008-10-02T10:00:00-07:00</published><updated>2008-10-02T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-02:/depressed.html</id><summary type="html">&lt;p&gt;Watching the Palin/Biden debate and the subsequent babbling by the TV talking heads has me depressed. Nothing of substance was said during the entire debate. What we witnessed was an audition for a supporting role in a B movie, not a debate between potential 2nd in commands of the …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Watching the Palin/Biden debate and the subsequent babbling by the TV talking heads has me depressed. Nothing of substance was said during the entire debate. What we witnessed was an audition for a supporting role in a B movie, not a debate between potential 2nd in commands of the most powerful country in the world.&lt;/p&gt;
&lt;p&gt;Apparently these folks haven't noticed, but we're in the midst of the most serious economic downturn since the great depression. We're neck deep in two active wars. There are serious problems to solve. Are sound bites, repeated claims of "maverick", and milf references really the best we have to offer?&lt;/p&gt;
&lt;p&gt;What is depressing is not that these folks talk in pre-cooked, substance-free parrotings, but that we really and truly are stupid enough to not only tolerate, but to encourage this.&lt;/p&gt;
&lt;p&gt;Please, give me something to vote on beyond how folksy, how old, how female, how dark, and how maverick these people are. I'm not trying to pick the person who looks the most like the president, but the one who will act the most president.&lt;/p&gt;
&lt;p&gt;Bah. Humbug.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Nookiller"</title><link href="https://www.parand.com/nookiller.html" rel="alternate"/><published>2008-10-02T10:00:00-07:00</published><updated>2008-10-02T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-10-02:/nookiller.html</id><summary type="html">&lt;p&gt;Is it me or does Palin struggle to say "nookiller" instead of nuclear? It seems like she knows the correct pronunciation but goes out of her way to say it incorrectly. Some sort of Bushism or republicanism maybe?&lt;/p&gt;
&lt;p&gt;Actually it'd be interesting to draw party lines along pronunciation. I say …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Is it me or does Palin struggle to say "nookiller" instead of nuclear? It seems like she knows the correct pronunciation but goes out of her way to say it incorrectly. Some sort of Bushism or republicanism maybe?&lt;/p&gt;
&lt;p&gt;Actually it'd be interesting to draw party lines along pronunciation. I say potato, you say potAto.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Happy: Hadoop with Python (Jython)"</title><link href="https://www.parand.com/happy-hadoop-with-python-jython.html" rel="alternate"/><published>2008-09-24T10:00:00-07:00</published><updated>2008-09-24T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-09-24:/happy-hadoop-with-python-jython.html</id><content type="html">&lt;p&gt;The &lt;a href="http://www.freebase.com/"&gt;Freebase&lt;/a&gt; folks have open sourced their Python (Jython) based Hadoop framework, calling it &lt;a href="http://code.google.com/p/happy/"&gt;Happy&lt;/a&gt;. Looks interesting, will need to give it a whirl when I get a chance.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Best Way To Automatically Convert Flickr Images to FaceBook Albums?"</title><link href="https://www.parand.com/best-way-to-automatically-convert-flickr-images-to-facebook-albums.html" rel="alternate"/><published>2008-09-22T10:00:00-07:00</published><updated>2008-09-22T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-09-22:/best-way-to-automatically-convert-flickr-images-to-facebook-albums.html</id><summary type="html">&lt;p&gt;Here's a lazyweb question for you: what's the best way to convert my flickr photo stream into facebook albums on an automated, continual basis? I much prefer dealing with flickr than facebook for photos, but many of my lazy friends are on facebook, keep asking for photos, but are apparently …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Here's a lazyweb question for you: what's the best way to convert my flickr photo stream into facebook albums on an automated, continual basis? I much prefer dealing with flickr than facebook for photos, but many of my lazy friends are on facebook, keep asking for photos, but are apparently unable to click over to flickr or subscribe to the RSS feed.&lt;/p&gt;
&lt;p&gt;There should be an easy way to have my photos automagically show up in facebook, right? I tried the top 2 flickr apps in facebook but they don't seem to do this.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Productivity Tip: Forget The Power Cord"</title><link href="https://www.parand.com/productivity-tip-forget-the-power-cord.html" rel="alternate"/><published>2008-09-17T10:00:00-07:00</published><updated>2008-09-17T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-09-17:/productivity-tip-forget-the-power-cord.html</id><summary type="html">&lt;p&gt;How's this for a productivity tip: leave your power cord at home. I'm in this situation now, and I'll tell ya, it does bring a razor sharp focus to what you need to be doing with those precious few minutes you have of computer time.&lt;/p&gt;
&lt;p&gt;(Of course if I was …&lt;/p&gt;</summary><content type="html">&lt;p&gt;How's this for a productivity tip: leave your power cord at home. I'm in this situation now, and I'll tell ya, it does bring a razor sharp focus to what you need to be doing with those precious few minutes you have of computer time.&lt;/p&gt;
&lt;p&gt;(Of course if I was being really productive I'd be working instead of posting this)&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Disco: Erlang/Python Based Map-Reduce"</title><link href="https://www.parand.com/disco-erlangpython-based-map-reduce.html" rel="alternate"/><published>2008-09-15T10:00:00-07:00</published><updated>2008-09-15T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-09-15:/disco-erlangpython-based-map-reduce.html</id><content type="html">&lt;p&gt;&lt;a href="http://discoproject.org/"&gt;Disco&lt;/a&gt; is a map-reduce framework written in Erlang and Python. Seems reasonable - I definitely prefer Python to Java for writing maps and reduces, and Erlang is rumored to be good at parallel stuff.&lt;/p&gt;
&lt;p&gt;Interestingly no mention of an underlying distributed file system.&lt;/p&gt;
&lt;p&gt;Via &lt;a href="http://highscalability.com/mapreduce-framework-disco"&gt;High Scalability&lt;/a&gt;.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Live Maps Rocks"</title><link href="https://www.parand.com/live-maps-rocks.html" rel="alternate"/><published>2008-09-15T10:00:00-07:00</published><updated>2008-09-15T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-09-15:/live-maps-rocks.html</id><summary type="html">&lt;p&gt;Live doesn't get a lot of love and with those new ads Microsoft needs some serious help getting the word out, so let me say something nice about them. I've been using Live Maps lately, mainly because of the "Bird's eye view", and it's quickly becoming my favourite map app …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Live doesn't get a lot of love and with those new ads Microsoft needs some serious help getting the word out, so let me say something nice about them. I've been using Live Maps lately, mainly because of the "Bird's eye view", and it's quickly becoming my favourite map app. If you have't tried it give it a shot: &lt;a href="http://maps.live.com/"&gt;http://maps.live.com/&lt;/a&gt; . I'm guessing you'll like it.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Already Using Chrome Regularly"</title><link href="https://www.parand.com/already-using-chrome-regularly.html" rel="alternate"/><published>2008-09-09T10:00:00-07:00</published><updated>2008-09-09T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-09-09:/already-using-chrome-regularly.html</id><summary type="html">&lt;p&gt;I'm surprised to find I use Chrome pretty regularly already. It's mostly my interface to Gmail, Google Reader, and GCal, and sits quietly in the task bar until I need to check email. Lack of firebug and various other extensions prevent me from using it for everything, but it's part …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I'm surprised to find I use Chrome pretty regularly already. It's mostly my interface to Gmail, Google Reader, and GCal, and sits quietly in the task bar until I need to check email. Lack of firebug and various other extensions prevent me from using it for everything, but it's part of the regular line-up of apps.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Drizzle: MySQL Based Slim / Cloud-Oriented DB"</title><link href="https://www.parand.com/drizzle-mysql-based-slim-cloud-oriented-db.html" rel="alternate"/><published>2008-09-05T10:00:00-07:00</published><updated>2008-09-05T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-09-05:/drizzle-mysql-based-slim-cloud-oriented-db.html</id><summary type="html">&lt;p&gt;&lt;a href="http://drizzle.wikia.com/wiki/Drizzle_Wiki"&gt;Drizzle&lt;/a&gt; is interesting:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Drizzle: A High-Performance Microkernel DBMS for Scale-Out Applications&lt;br&gt;
Drizzle is a community-driven project based on the popular MySQL DBMS that is focused on MySQL's original goals of ease-of-use, reliability and performance.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Headed up by &lt;a href="http://en.wikipedia.org/wiki/Brian_Aker"&gt;Brian Aker&lt;/a&gt;, Director of Architecture at MySQL AB. Take a look at the …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;a href="http://drizzle.wikia.com/wiki/Drizzle_Wiki"&gt;Drizzle&lt;/a&gt; is interesting:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Drizzle: A High-Performance Microkernel DBMS for Scale-Out Applications&lt;br&gt;
Drizzle is a community-driven project based on the popular MySQL DBMS that is focused on MySQL's original goals of ease-of-use, reliability and performance.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Headed up by &lt;a href="http://en.wikipedia.org/wiki/Brian_Aker"&gt;Brian Aker&lt;/a&gt;, Director of Architecture at MySQL AB. Take a look at the &lt;a href="http://drizzle.wikia.com/wiki/MySQL_Differences"&gt;MySQL Differences&lt;/a&gt; page and you'll mostly see features &lt;em&gt;removed&lt;/em&gt; and cleaned up, which is great. Designed for high levels of concurrency, targeted to "cloud" applications. &lt;a href="http://monty-says.blogspot.com/2008/07/what-if.html"&gt;Monty&lt;/a&gt; and &lt;a href="http://krow.livejournal.com/602409.html"&gt;Brian's&lt;/a&gt; posts offer motivation for the project.&lt;/p&gt;
&lt;p&gt;Something to keep an eye on.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Python Generator Expressions"</title><link href="https://www.parand.com/python-generator-expressions.html" rel="alternate"/><published>2008-09-04T10:00:00-07:00</published><updated>2008-09-04T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-09-04:/python-generator-expressions.html</id><summary type="html">&lt;p&gt;I wasn't aware of generator expressions:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nv"&gt;wwwlog&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;open&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;access-log&amp;quot;&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;bytecolumn&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;line&lt;/span&gt;.&lt;span class="nv"&gt;rsplit&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;None&lt;/span&gt;,&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;[&lt;span class="mi"&gt;1&lt;/span&gt;]&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;line&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;wwwlog&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;bytes&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;int&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;x&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;x&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;bytecolumn&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;x&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;-&amp;#39;&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;print&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Total&amp;quot;&lt;/span&gt;,&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;sum&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;bytes&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Similar to list comprehensions, but evaluated lazily. &lt;a href="http://www.voidspace.org.uk/python/weblog/arch_d7_2008_08_30.shtml#e1008"&gt;Voidspace describes it&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;None of the generators are consumed until the …&lt;/p&gt;&lt;/blockquote&gt;</summary><content type="html">&lt;p&gt;I wasn't aware of generator expressions:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nv"&gt;wwwlog&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;open&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;access-log&amp;quot;&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;bytecolumn&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;line&lt;/span&gt;.&lt;span class="nv"&gt;rsplit&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;None&lt;/span&gt;,&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;[&lt;span class="mi"&gt;1&lt;/span&gt;]&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;line&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;wwwlog&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;bytes&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;int&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;x&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;x&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;bytecolumn&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;x&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;-&amp;#39;&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;print&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Total&amp;quot;&lt;/span&gt;,&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;sum&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;bytes&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Similar to list comprehensions, but evaluated lazily. &lt;a href="http://www.voidspace.org.uk/python/weblog/arch_d7_2008_08_30.shtml#e1008"&gt;Voidspace describes it&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;None of the generators are consumed until the final call to &lt;code&gt;sum&lt;/code&gt;. As it iterates a line at a time (not keeping the log file in memory) it can handle huge log files - and as a bonus it runs faster than a typical solution with loops!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Neat.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Trying Google Chrome, So Far So Good"</title><link href="https://www.parand.com/trying-google-chrome-so-far-so-good.html" rel="alternate"/><published>2008-09-02T10:00:00-07:00</published><updated>2008-09-02T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-09-02:/trying-google-chrome-so-far-so-good.html</id><summary type="html">&lt;p&gt;The &lt;a href="http://google.com/chrome"&gt;Chrome download&lt;/a&gt; was surprisingly fast (as in, less than 5 seconds). FireFox options import during install didn't work, but it's been smooth sailing since then. It's snappy and so far not buggy. Aesthetics of rendering web pages is good, seems better than FireFox. Quite fast too.&lt;/p&gt;
&lt;p&gt;I remember thinking …&lt;/p&gt;</summary><content type="html">&lt;p&gt;The &lt;a href="http://google.com/chrome"&gt;Chrome download&lt;/a&gt; was surprisingly fast (as in, less than 5 seconds). FireFox options import during install didn't work, but it's been smooth sailing since then. It's snappy and so far not buggy. Aesthetics of rendering web pages is good, seems better than FireFox. Quite fast too.&lt;/p&gt;
&lt;p&gt;I remember thinking the Konqueror guys were crazy for writing yet another HTML renedering engine. That turned into WebKit, and now it's in Safari, the iPhone, and Chrome. Amazing.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Google Chrome: Based on WebKit instead of Mozilla"</title><link href="https://www.parand.com/google-chrome-based-on-webkit-instead-of-mozilla.html" rel="alternate"/><published>2008-09-01T10:00:00-07:00</published><updated>2008-09-01T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-09-01:/google-chrome-based-on-webkit-instead-of-mozilla.html</id><content type="html">&lt;p&gt;Interesting that Google's Chrome is based on WebKit instead of the Mozilla rendering engine…&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Javascript Inheritance"</title><link href="https://www.parand.com/javascript-inheritance.html" rel="alternate"/><published>2008-09-01T10:00:00-07:00</published><updated>2008-09-01T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-09-01:/javascript-inheritance.html</id><summary type="html">&lt;p&gt;Javascript inheritance is another one of those topics that always escapes my mind, so I'm recording it here for future reference.&lt;/p&gt;
&lt;p&gt;I tried to get into &lt;a href="http://javascript.crockford.com/prototypal.html"&gt;Crockford's Prototypal Inheritance&lt;/a&gt; method but I like the plain-old prototype inheritance without the object.create better. It's entirely possible that I'm not quite getting …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Javascript inheritance is another one of those topics that always escapes my mind, so I'm recording it here for future reference.&lt;/p&gt;
&lt;p&gt;I tried to get into &lt;a href="http://javascript.crockford.com/prototypal.html"&gt;Crockford's Prototypal Inheritance&lt;/a&gt; method but I like the plain-old prototype inheritance without the object.create better. It's entirely possible that I'm not quite getting Crockford's method and its advantages; feel free to enlighten me by leaving a comment.&lt;/p&gt;
&lt;p&gt;Anyway, here's what I'm going with: We'll have a base class (actually an object) English that says "hello" and "goodbye". We'll have a Spanglish class (actually an object) that inherits from English and says "ola" instead of "hello" (over-rides the hello method), but keeps saying "bye" (inherits the bye method from English).&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;Spanglish.prototype = new English\(\);&lt;/code&gt; line does the actual inheritance by setting Spanglish's prototype to be an instance of English.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nx"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;English&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="nx"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hello&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="nx"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;quot;hello&amp;quot;&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="nx"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bye&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="nx"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;quot;bye&amp;quot;&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="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Spanglish&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="nx"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hello&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="nx"&gt;function&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="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;quot;ola&amp;quot;&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="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;Spanglish&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&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="nx"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;English&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;e&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="nx"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;English&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;s&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="nx"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Spanglish&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="c1"&gt;// prints &amp;quot;hello&amp;quot;&lt;/span&gt;
&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bye&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="c1"&gt;// prints &amp;quot;bye&amp;quot;&lt;/span&gt;
&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="c1"&gt;// prints &amp;quot;ola&amp;quot;&lt;/span&gt;
&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bye&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="c1"&gt;// prints &amp;quot;bye&amp;quot;, inherited from English&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="misc"/></entry><entry><title>"Being Smarter About Car Repair"</title><link href="https://www.parand.com/being-smarter-about-car-repair.html" rel="alternate"/><published>2008-08-27T10:00:00-07:00</published><updated>2008-08-27T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-08-27:/being-smarter-about-car-repair.html</id><summary type="html">&lt;p&gt;&lt;img alt="Car Repair" src="http://farm1.static.flickr.com/77/225837615_3650c761af_m_d.jpg"&gt;&lt;/p&gt;
&lt;p&gt;What I know about the innards automobiles I learned from a book on &lt;a href="http://en.wikipedia.org/wiki/Wankel_engine"&gt;Wankel engines&lt;/a&gt; when I was 8. So when my "check engine" light turned on I knew I'd be in for a severe siphoning of money out of my pocket.&lt;/p&gt;
&lt;p&gt;Buoyed by my strong sense of miserliness, however …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="Car Repair" src="http://farm1.static.flickr.com/77/225837615_3650c761af_m_d.jpg"&gt;&lt;/p&gt;
&lt;p&gt;What I know about the innards automobiles I learned from a book on &lt;a href="http://en.wikipedia.org/wiki/Wankel_engine"&gt;Wankel engines&lt;/a&gt; when I was 8. So when my "check engine" light turned on I knew I'd be in for a severe siphoning of money out of my pocket.&lt;/p&gt;
&lt;p&gt;Buoyed by my strong sense of miserliness, however, I decided to take a stand and brave the world mechanical. And I'm proud to say I managed to change a broken O2 sensor on my Honda Accord without having to visit a mechanic (or, to be more accurate, watched as my dad changed it, but hey, I was there).&lt;/p&gt;
&lt;p&gt;Here's the key trick: all cars built since 1996 have a standard system called OBD-II (On-Board Diagnostics) that monitors much of your car and its health and reports standard codes for any mis-behaving components. There are code readers available from your favorite retailer (here's &lt;a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;amp;location=http%3A%2F%2Fwww.amazon.com%2FActron-CP9125-PocketScan-Diagnostic-Post-1996%2Fdp%2FB0007LEG2K%3Fie%3DUTF8%26s%3Dautomotive%26qid%3D1219868907%26sr%3D1-2&amp;amp;tag=parandcom-20&amp;amp;linkCode=ur2&amp;amp;camp=1789&amp;amp;creative=9325"&gt;one from Amazon for $62&lt;/a&gt;&lt;img alt="" src="http://www.assoc-amazon.com/e/ir?t=parandcom-20&amp;amp;l=ur2&amp;amp;o=1"&gt;) or to borrow from certain auto repair shops.&lt;/p&gt;
&lt;p&gt;Connecting the reader to car is generally easy (it was simply a matter of attaching it to the connector under the steering wheel in the Honda) and you can find explanations for the codes online.&lt;/p&gt;
&lt;p&gt;Armed with information about what exactly is wrong with your car you can have a much more … productive conversation with your mechanic.&lt;/p&gt;
&lt;p&gt;Or, you can fix it yourself, as we did. Changing the O2 sensor turned out to be surprisingly simple, and not only did I save myself about $300, I also feel extremely proud of myself. I think this is my crowning achievement of 2008. Handy, I am.&lt;/p&gt;
&lt;p&gt;Image courtesy of &lt;a href="http://flickr.com/photos/themadman/225837615/"&gt;MadMan the Mighty&lt;/a&gt;.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Google Reader Style Hotkeys For Image Viewing"</title><link href="https://www.parand.com/google-reader-style-hotkeys-for-image-viewing.html" rel="alternate"/><published>2008-08-25T10:00:00-07:00</published><updated>2008-08-25T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-08-25:/google-reader-style-hotkeys-for-image-viewing.html</id><summary type="html">&lt;p&gt;I frequently run into pages with loads of images (&lt;a href="http://www.boston.com/bigpicture/2008/08/beijing_2008_its_a_wrap.html"&gt;here's one&lt;/a&gt; via &lt;a href="http://paul.kedrosky.com/archives/2008/08/25/linkfest_olympi.html"&gt;Kedrosky&lt;/a&gt;, &lt;a href="http://stuff.thdesign.be/forum/varia/OS.html"&gt;here's&lt;/a&gt; another, and here's &lt;a href="http://headinjurytheater.com/abcexcuse.htm"&gt;yet another&lt;/a&gt;). Viewing these images involves a dance of scrolling or hitting space, then scrolling again to get the image lined up in the viewable part of the browser, and repeating over and …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I frequently run into pages with loads of images (&lt;a href="http://www.boston.com/bigpicture/2008/08/beijing_2008_its_a_wrap.html"&gt;here's one&lt;/a&gt; via &lt;a href="http://paul.kedrosky.com/archives/2008/08/25/linkfest_olympi.html"&gt;Kedrosky&lt;/a&gt;, &lt;a href="http://stuff.thdesign.be/forum/varia/OS.html"&gt;here's&lt;/a&gt; another, and here's &lt;a href="http://headinjurytheater.com/abcexcuse.htm"&gt;yet another&lt;/a&gt;). Viewing these images involves a dance of scrolling or hitting space, then scrolling again to get the image lined up in the viewable part of the browser, and repeating over and over again.&lt;/p&gt;
&lt;p&gt;The better user experience would be to have Google Reader style hotkeys that bring each picture into view, lining it up properly for easy viewing. You'd be able to hit "j" after viewing each picture to see the next. No more messing with the scrollbars.&lt;/p&gt;
&lt;p&gt;I'm guessing a greasemonkey script to enable this with any page would be pretty straight forward to do. Anybody know if it already exists? If not, someone should do it.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Three"</title><link href="https://www.parand.com/three.html" rel="alternate"/><published>2008-08-25T10:00:00-07:00</published><updated>2008-08-25T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-08-25:/three.html</id><content type="html">&lt;p&gt;&lt;strong&gt;Three.&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The number of programmers who will write most of the code in a system developed by a team of 24 engineers, two project managers, three group leaders, a quality lead and an office manager.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;From &lt;a href="http://www.jroller.com/rolsen/entry/some_important_numbers_for_developers"&gt;Russ Olsen&lt;/a&gt;.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Startup VP Technology / CTO Opportunites"</title><link href="https://www.parand.com/startup-vp-technology-cto-opportunites.html" rel="alternate"/><published>2008-08-23T10:00:00-07:00</published><updated>2008-08-23T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-08-23:/startup-vp-technology-cto-opportunites.html</id><summary type="html">&lt;p&gt;Several friends have been at work on several startups and are looking for technology leaders to round out their teams. One opportunity is in the social network / eduction space and is looking for the VP Technology / CTO as well as good web/php guys. Another is more hardware related. Both …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Several friends have been at work on several startups and are looking for technology leaders to round out their teams. One opportunity is in the social network / eduction space and is looking for the VP Technology / CTO as well as good web/php guys. Another is more hardware related. Both are very viable early stage companies in San Diego. If you have interest or know of people who might let me know - darugar at gmail .&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Terrorists: There Is No Profile"</title><link href="https://www.parand.com/terrorists-there-is-no-profile.html" rel="alternate"/><published>2008-08-22T10:00:00-07:00</published><updated>2008-08-22T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-08-22:/terrorists-there-is-no-profile.html</id><content type="html">&lt;p&gt;&lt;a href="http://www.schneier.com/blog/archives/2008/08/mi5_on_terroris.html"&gt;MI5 report on terrorist profiling&lt;/a&gt;, via Schneier. The short version: it is very difficult to come up with a valid profile.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"TraceMonkey: It’s A Big Deal"</title><link href="https://www.parand.com/tracemonkey-its-a-big-deal.html" rel="alternate"/><published>2008-08-22T10:00:00-07:00</published><updated>2008-08-22T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-08-22:/tracemonkey-its-a-big-deal.html</id><summary type="html">&lt;p&gt;Mozilla announces &lt;a href="http://weblogs.mozillazine.org/roadmap/archives/2008/08/tracemonkey_javascript_lightsp.html"&gt;TraceMonkey&lt;/a&gt;, a &lt;a href="http://ejohn.org/blog/tracemonkey/"&gt;just-in-time compiler for Javascript&lt;/a&gt;. If you've watched &lt;a href="http://stanford-online.stanford.edu/courses/ee380/080507-ee380-300.asx"&gt;Steve Yegge's talk on Dynamic Languages&lt;/a&gt; (&lt;a href="http://steve-yegge.blogspot.com/2008/05/dynamic-languages-strike-back.html"&gt;transcript&lt;/a&gt;) you've already had a taste of what the future could look like for dynamic languages - namely, performance on par with today's low level languages.&lt;/p&gt;
&lt;p&gt;Javascript started as an ugly language but has …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Mozilla announces &lt;a href="http://weblogs.mozillazine.org/roadmap/archives/2008/08/tracemonkey_javascript_lightsp.html"&gt;TraceMonkey&lt;/a&gt;, a &lt;a href="http://ejohn.org/blog/tracemonkey/"&gt;just-in-time compiler for Javascript&lt;/a&gt;. If you've watched &lt;a href="http://stanford-online.stanford.edu/courses/ee380/080507-ee380-300.asx"&gt;Steve Yegge's talk on Dynamic Languages&lt;/a&gt; (&lt;a href="http://steve-yegge.blogspot.com/2008/05/dynamic-languages-strike-back.html"&gt;transcript&lt;/a&gt;) you've already had a taste of what the future could look like for dynamic languages - namely, performance on par with today's low level languages.&lt;/p&gt;
&lt;p&gt;Javascript started as an ugly language but has been steadily &lt;a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;amp;location=http%3A%2F%2Fwww.amazon.com%2FJavaScript-Good-Parts-Douglas-Crockford%2Fdp%2F0596517742%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1219472734%26sr%3D8-1&amp;amp;tag=parandcom-20&amp;amp;linkCode=ur2&amp;amp;camp=1789&amp;amp;creative=9325"&gt;shedding its bad parts&lt;/a&gt;&lt;img alt="" src="http://www.assoc-amazon.com/e/ir?t=parandcom-20&amp;amp;l=ur2&amp;amp;o=1"&gt; and adopting a &lt;a href="http://jquery.com/"&gt;beautiful functional style&lt;/a&gt;. With the performance piece figured out and a tremendously large number of installations and runtimes (just about every browser in existence has a Javascript engine), it could become the most important programming language of the near future.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Awesome"</title><link href="https://www.parand.com/awesome.html" rel="alternate"/><published>2008-08-21T10:00:00-07:00</published><updated>2008-08-21T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-08-21:/awesome.html</id><content type="html">&lt;p&gt;&lt;a href="http://www.urbandictionary.com/define.php?term=parand"&gt;Parand&lt;/a&gt;.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"A Beautiful Python Twitter API"</title><link href="https://www.parand.com/a-beautiful-python-twitter-api.html" rel="alternate"/><published>2008-08-18T10:00:00-07:00</published><updated>2008-08-18T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-08-18:/a-beautiful-python-twitter-api.html</id><summary type="html">&lt;p&gt;Mike Verdon's &lt;a href="http://mike.verdone.ca/twitter/"&gt;Python Twitter Tools&lt;/a&gt; is less popular and findable than the Dewitt Clinton's &lt;a href="http://code.google.com/p/python-twitter/"&gt;python-twitter&lt;/a&gt; (I only found the former from an email on the latter's mailing list), but it's a beautiful library. 125 lines, most of which are comments. It implements the full API by implementing a single call …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Mike Verdon's &lt;a href="http://mike.verdone.ca/twitter/"&gt;Python Twitter Tools&lt;/a&gt; is less popular and findable than the Dewitt Clinton's &lt;a href="http://code.google.com/p/python-twitter/"&gt;python-twitter&lt;/a&gt; (I only found the former from an email on the latter's mailing list), but it's a beautiful library. 125 lines, most of which are comments. It implements the full API by implementing a single call class that handles everything (and that class is only a few lines). A good library to use if you're trying to access Twitter via Python, and a good source for learning and inspiration if you're writing a library / wrapper.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Sickening Olympic Coverage"</title><link href="https://www.parand.com/sickening-olympic-coverage.html" rel="alternate"/><published>2008-08-18T10:00:00-07:00</published><updated>2008-08-18T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-08-18:/sickening-olympic-coverage.html</id><summary type="html">&lt;p&gt;Watching the women's uneven bars. The announcers have spent the vast majority of the time whining and moaning Nastia's the 2nd place finish.&lt;/p&gt;
&lt;p&gt;Now I recall earlier gymnastics events where these same announcers said starting first is a huge disadvantage and effectively penalizes the American competitor (pretty sure it was …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Watching the women's uneven bars. The announcers have spent the vast majority of the time whining and moaning Nastia's the 2nd place finish.&lt;/p&gt;
&lt;p&gt;Now I recall earlier gymnastics events where these same announcers said starting first is a huge disadvantage and effectively penalizes the American competitor (pretty sure it was Shawn Johnson's event). Hmm. The Chinese winner of this event went first. I didn't hear any whining about how she was at a disadvantage.&lt;/p&gt;
&lt;p&gt;We're also hearing about the incompetency of the judges. Apparently the Australian judge favors the Chinese. Makes sense that Australia would pick China over US. Eh. I'm sure it does somehow. Nevermind that his score was actually thrown out (top and bottom scores are thrown out).&lt;/p&gt;
&lt;p&gt;The tie-break procedure is also apparently anti-U.S. I've heard Al-Qaeda was behind instituting it.&lt;/p&gt;
&lt;p&gt;Watching the track events earlier I was shocked to see there were 8 athletes running in each heat. The announcers announced 2, and the camera was very clear that there were only 2 athletes running. Turns out there are other countries competing besides America. Which really pisses me off - don't they know it's ALL ABOUT AMERICA?&lt;/p&gt;
&lt;p&gt;I'm sick of NBC. These guys are making America look like a bunch whining, sore losers, which is anything but the truth. The athletes are doing a fantastic job and the venue is beautiful. If only these NBC idiots would embrace the spirit of the Olympics and realize it's not all America versus the rest of the world. It's a celebration of the athletic spirit of the world.&lt;/p&gt;
&lt;p&gt;There we go. And they finish with how America's dominance of baseball and softball is so complete the Olympic committee had to drop them from the Olympics.&lt;/p&gt;
&lt;p&gt;Think back to high school, to the rich kid who was a good athlete and had everything else going for him, but was still an asshole? There you go. Apparently that's who we are. Despite everything we have we still can't find it in ourselves to be gracious.&lt;/p&gt;
&lt;p&gt;Damned Australia.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Sweet Sleep, Part Deux"</title><link href="https://www.parand.com/sweet-sleep-part-deux.html" rel="alternate"/><published>2008-08-17T10:00:00-07:00</published><updated>2008-08-17T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-08-17:/sweet-sleep-part-deux.html</id><summary type="html">&lt;p&gt;Wife is in Florida with the youngest kid, and the other two spent most of the weekend at my parents', giving me a chance to engage in plenty of bad habits. Mostly work and sleep.&lt;/p&gt;
&lt;p&gt;It's an amazing feeling to wake up after more than 8 hours of sleep. Really …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Wife is in Florida with the youngest kid, and the other two spent most of the weekend at my parents', giving me a chance to engage in plenty of bad habits. Mostly work and sleep.&lt;/p&gt;
&lt;p&gt;It's an amazing feeling to wake up after more than 8 hours of sleep. Really quite fantastic. It's obvious with the kids - if they don't get enough sleep they're cranky and lethargic. The same is at work with adults, we're just better able to mask it.&lt;/p&gt;
&lt;p&gt;Anyway: sleep. I highly recommend it.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Trying Mercurial"</title><link href="https://www.parand.com/trying-mercurial.html" rel="alternate"/><published>2008-08-17T10:00:00-07:00</published><updated>2008-08-17T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-08-17:/trying-mercurial.html</id><summary type="html">&lt;p&gt;All the cool kids are into Git these days and I've been reading plenty of articles about how good it is and how to use it. The problem is, I don't really have a problem with Subversion. I know I should, because all the cool kids do, but I just …&lt;/p&gt;</summary><content type="html">&lt;p&gt;All the cool kids are into Git these days and I've been reading plenty of articles about how good it is and how to use it. The problem is, I don't really have a problem with Subversion. I know I should, because all the cool kids do, but I just don't run into a lot of issues with it. In the absence of a problem to solve it would simply be peer-pressure to give Git a shot.&lt;/p&gt;
&lt;p&gt;So in an attempt to remain &lt;a href="http://www.youtube.com/watch?v=qANMjwLmo6Y"&gt;ever-so-independent&lt;/a&gt; I'm going to try a distributed system, but not Git. I'm going with &lt;a href="http://www.selenic.com/mercurial/wiki/"&gt;Mercurial&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Actually mainly it's because Mercurial seems significantly simpler, and I'm a simple guy. It's also written in Python, which gives me a warm and fuzzy. And I'm finally motivated to try it because I'm going to try a code path which may not work out, and I understand these distributed systems deal with that well.&lt;/p&gt;
&lt;p&gt;Hmm. The main thing I'd want from a source code control system would be a bit of packaging and deployment intelligence built in. Maybe something to minify and join my javascript files and mend the files that reference them. I'm extremely pleased not to have a "make" step anywhere in my process, but I do miss some of the capabilities.&lt;/p&gt;
&lt;p&gt;If I'm making a mistake and I should go with Git, or perhaps CVS, do let me know.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Amazing Video Enhancement / Transformation Technique"</title><link href="https://www.parand.com/amazing-video-enhancement-transformation-technique.html" rel="alternate"/><published>2008-08-16T10:00:00-07:00</published><updated>2008-08-16T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-08-16:/amazing-video-enhancement-transformation-technique.html</id><summary type="html">&lt;p&gt;&lt;a href="http://grail.cs.washington.edu/projects/videoenhancement/videoEnhancement.htm"&gt;This&lt;/a&gt; is just incredible. The effects are amazing, but I'm guessing the models and tools behind what they do are going to fundamentally change the way we use video. Apparently these guys are divining a pretty good depth and color projection map from videos and photographs. With that you've added …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;a href="http://grail.cs.washington.edu/projects/videoenhancement/videoEnhancement.htm"&gt;This&lt;/a&gt; is just incredible. The effects are amazing, but I'm guessing the models and tools behind what they do are going to fundamentally change the way we use video. Apparently these guys are divining a pretty good depth and color projection map from videos and photographs. With that you've added entirely new dimensions to the readily available information conveyed by video, opening the door to a huge range of effects and enhancements. Looking forward to seeing more of this.&lt;/p&gt;</content><category term="misc"/></entry><entry><title>"Taste Vectors: OpenTaste"</title><link href="https://www.parand.com/taste-vectors-opentaste.html" rel="alternate"/><published>2008-07-18T10:00:00-07:00</published><updated>2008-07-18T10:00:00-07:00</updated><author><name>Parand Darugar</name></author><id>tag:www.parand.com,2008-07-18:/taste-vectors-opentaste.html</id><content type="html">&lt;p&gt;I couple of years ago I wrote about &lt;a href="/say/index.php/2005/03/10/taste-vectors-own-share-your-tastes-via-xml.html"&gt;Taste Vectors&lt;/a&gt;, did a bit of hacking, and not much else.&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://www.strands.com/"&gt;Strands&lt;/a&gt; folks have launched a similar concept in &lt;a href="http://www.opentaste.net/"&gt;OpenTaste&lt;/a&gt;. Worth a look, will write more if I get a chance.&lt;/p&gt;
&lt;p&gt;Via &lt;a href="http://blogs.sun.com/plamere/entry/portable_taste_data_opentaste"&gt;Duke Listens!&lt;/a&gt;&lt;/p&gt;</content><category term="misc"/></entry></feed>