Kevin Kleinfelter's blog

Uninstall a Perl Module

To uninstall a Perl module (delete, remove, etc.):

cpanp uninstall module_name

or maybe

sudo cpanp uninstall module_name

Python: Muli-level if statement on one line

I saw an answer for this on StackExchange, but nobody seemed to understand why it was desirable... (I'm not enough of a participant in StackExchange to have enough reputation points to post a comment there.)

How can I combine multiple if statements onto a single line? I want

if x > 89:
    y = 'A'
elif x > 79:
   y = 'B'
   y = 'F'

on a single line.

Yes, it can be done. Yes, it doing so does serve a purpose. Consider the lambda.

Weather and Running and Clothing

My experience:

ggplot examples

ggplot a data frame with two series mixed together:

ggplot(df, aes('x-column-name','y-column-name',color='column-with-value-that-distinguishes-the-two-series')) + geom_point() + geom_line() + ggtitle('title') + xlab('xlab') + ylab('ylab')

e.g. For a data frame with a farmer's data for count of apples and pears grown in each year, with columns year, count, fruit

ggplot(df, aes('year','count',color='fruit')) + geom_point() + geom_line() + ggtitle('McDonald Farm Fruits') + xlab('Year') + ylab('Bushels')

The transfer transaction is to an account that no longer exists in Quicken

I have a retirement account and a checking account (and more) in Quicken. I have many transfers from the checking account to the retirement account. When I right-click a transaction in the retirement account and select "Go To Transfer", Quicken 2014 tells me "The transfer transaction is to an account that no longer exists in Quicken." It is wrong. It is a bug in Quicken.

Numpy (Python)

I'm learning Numpy. Here are some notes:

Dot Product

a = [1, 2, 3]
b = [10, 20, 30],b)
  • Reminder: Dot product of a,b is 110 + 220 + 3*30

Pandas (Python)

I'm learning the Pandas library for Python. Here are some note.

Getting Started With AWS EMR 4.x

There have been some significant changes in Amazon Web Services (AWS) Elastic MapReduce (EMR) with the 4.x release. The Amazon doc hasn't been rewritten for 4.x - just a summary of changes, making it tough to follow tutorials. Here are some tips for getting started with AWS EMR. I assume you are using Linux or a Mac. Windows users will have to make some minor adjustments, but the basic ideas apply.

Firefox Prompts for ID/Password Too Much

If you are using Firefox in a corporate environment, and you get too many prompts for ID/password, it may be because your proxy server requires authentication for some/all sites. To make the prompts go away:

  • Tools >> Options >> Advanced >> Network >> Settings
  • Ensure 'Do not prompt for authentication if password is saved' is selected.

Jupyter Notes

All of this is on a Mac:


Subscribe to RSS - Kevin Kleinfelter's blog