Sort List Of Dictionaries By Key: Python 1 Liner

How can you sort a list of dictionaries by a key contained in each dictionary using Python? Can you do it in 1 line to show off your friends? Of course! To sort a list of dictionaries use the sorted() function with the key parameter set to a lambda function that uses the common key found in each dictionary that you want to sort the list by. Previously I posted a task where I needed to sort a list after the second element onwards, in this article I’ll use the same techniques but apply this to a specific key in each dictionary. ...

July 6, 2021 · 3 min · 515 words · Ryan Sheehy

Python: Sort List From Second (or Nth Index) On

How do you sort a list by the second (or nth) element on in Python? How can you leave the first or nth elements in a list as they are but then have the remaining elements in the list sorted? When applying the .sort() list method on a list Python will sort all elements in that list, but what if you only wanted to sort after a certain index number? ...

July 6, 2021 · 6 min · 1239 words · Ryan Sheehy

Reverse Order Of List In Python Without For Loops (Examples, One-Liners, No Imports)

There have been times when after creating a list in Python I’ve wanted to sort a list and then have the list reversed from ascending to descending. To reverse the order of a list in Python use either the .reverse() list method which mutates the original list, or the slice operator technique [::-1] which returns a new list. What are the quickest ways to get this task done? Here are two ways to do the same thing, but one method will mutate the original list when operated, whereas the other outputs a new list and keeps the original list as it originally was. ...

July 2, 2021 · 3 min · 504 words · Ryan Sheehy

How To Use FORMULA In Filter Expression - SuiteScript 2.0

I had recently had to use a FORMULA type in a SuiteScript 2.0 search and found it as a very useful filter for list values. To use FORMULA types in a filter expression, such as, FORMULATEXT, FORMULAPERCENT, FORMULANUMERIC, FORMULACURRENCY or FORMULADATETIME just prefix the type of FORMULA at the beginning of your filter expression and then write your formula. Use the operator and value as you normally would with any other filter expression. ...

June 1, 2021 · 2 min · 405 words · Ryan Sheehy

How Many Spaces Is A Tab: 2, 3, 4 or 5?

In Microsoft Word you can control whether or not you want to see the white space characters in your document. This helps to check you haven’t incorrectly inserted a tab where a space should have gone and vice versa. Generally, a tab is the same width as 4 to 5 spaces provided the font being used equally sizes each character. For example, the Courier font’s tab equals 5 spaces, whereas the Arial font is 11 spaces to each tab when the font size for both is set to 12. ...

May 17, 2021 · 4 min · 679 words · Ryan Sheehy

How To Lock A Column In Google Sheets

Very similar to our previous article on how to make a header row in Google Sheets, in this article we’ll show how you can lock a column in Google Sheets. To lock a column in Google Sheets easily just navigate and click on the View menu, then on the sub-menu Freeze, then click on either of the options presented: “No column” (to remove any locked columns), “1 column” (to lock the first column), “2 columns” (to lock the first two columns), or “Up to current column” (depends on where the current active cell is located). ...

May 13, 2021 · 4 min · 657 words · Ryan Sheehy

How To Make A Header Row In Google Sheets

I was recently working with a lot data on my Google Sheets spreadsheet and as I scrolled down the page the information from the top rows moved off and I could no longer see (and could no longer remember) what each column’s label in the first row was. Thankfully there’s a nifty little feature in Google Sheets where you can freeze a set number of rows to lock the screen from moving as you continue to scroll down the page. ...

May 12, 2021 · 4 min · 819 words · Ryan Sheehy

Word Count WordPress - PHP Code

If you want to know how many words your WordPress articles have you can open up each post individually and by clicking on the top left-hand corner’s information icon it will display the number of words. For example, when I completed this post I was curious as to the quantity of words I wrote and upon clicking the information icon within that post was informed of the following data: ...

April 13, 2021 · 4 min · 682 words · Ryan Sheehy

Ignore Blank Cells In IF Functions Google Sheets

In a previous post, I explored how to ignore blank cells when using the QUERY function in Google Sheets, which had its own distinct way of removing blank cells from the data capture. But how do you ignore blank cells in your spreadsheet when you’re not in a QUERY function? What if you’re in one of the many different IF functions such as IF, IFS, SUMIF, SUMIFS, COUNTIF, COUNTIFS, AVERAGEIF, AVERAGEIFS, MAXIFS, MINIFS (etc). How do you write a condition that checks if a cell is blank in those functions? ...

April 7, 2021 · 4 min · 784 words · Ryan Sheehy

SuiteScript UNEXPECTED_ERROR With RESTlet

A recent project hit a roadblock when I changed some code depending on the N/search module and refactored it to use N/query module. While I had some initial hassles with accepting the Beta nature of the N/query script I soon ran into another error once I had got the code to a level I knew would work: { "error": { "code": "UNEXPECTED_ERROR", "message": "An unexpected SuiteScript error has occurred" } } Great. ...

April 1, 2021 · 7 min · 1383 words · Ryan Sheehy