12 Basic Commands with NumPy Array

NumPy (pronounced as Num-pee or Num-pai) is one of the important python packages (other being SciPy) for scientific computing. NumPy offers fast and flexible data structures for multi-dimensional arrays and matrices with numerous mathematical functions/operations associated with it. Core data structure in NumPy is “ndarray”, short for n-dimesional array for storing numeric values. Let us […]

10 Free Online Resources/Books to learn R and Data Science

If you are interested in learning R and Data Science, but not interested in spending money on books, you are definitely in good space. There are a number of fantastic books and resources available online for free from top most creators and scientists. Here are such free online books and resources for learning R and […]

6 Coding Style Tips for R

If you are a beginner R programmer, it is a good idea to learn and start using the good practices in coding. Even if the code is just for you, it is a good idea to practice good style guide to help the “future yourself”. Google has a good list of things to do and […]

How to create Pandas DataFrame from multiple lists?

NumPy is fantastic for numerical data. One can really do powerful operations with numerical data easily and much faster. However, if your data is of mixed type, like some columns are strings while the others are numeric, using data frame with Pandas is the best option. How to create Pandas DataFrame from lists? Let us […]

How to read a numerical data/file in Python with numpy?

Often you may need to read a file containing numerical data in Python for. One of the options is to import the file/data in Python is use Python’s NumPy library. There are number of advantages to use NumPy. NumPy is designed to deal with numerical data, it is fast and it has loads of built-in […]

How to read entire text file in Python?

Often one might need to read the entire content of a text file (or flat file) at once in python. In this post, we showed an example of reading the whole file and reading a text file line by line. Here is another way to import the entire content of a text file.

Five Examples of Using List Comprehensions in Python

List Comprehensions in Python are awesome. A while back wrote a post on some examples of using List Comprehensions in Python. Here are more examples of List Comprehensions 1. Converting a list of integers to a list of strings Let us say we have a list of integers like and we can use List Comprehensions […]

Three Ways to Merge (or flatten) Lists in Python

Often you may have to flatten a list of lists or merge multiple lists into a single list in python. Obviously there are multiple ways to go about it. Here are three ways to flatten or merge lists in to a list. Merge with “+” Operator” If you have three separate lists like [1, 2, […]

Paste command examples in Linux/Mac OS

The Linux command paste is one of the powerful commands that can be used to “merge multiple files in to a single file” and also “collapse multiple lines in a single file to a new file”. Here are some basic examples of using the paste command. Paste command to merge multiple files into a single […]

How to join PDF files in Mac on Terminal?

In Mac, you can use Preview to join multiple pdf files into a single pdf file. A more convenient way is to join/merge multiple pdf files from command line on Terminal. More recent Mac OS X versions already have Python script to merge multiple pdf files into a single pdf file. Here is how to […]