Posts

Advanced Data Types in Go

Image
Introduction In my previous blog , I discussed the basic data types in Go. In this blog, we will be going a step ahead and learning about advanced data types in GO. We will be talking about Arrays Slices Maps Structs Arrays Arrays as in other traditional languages are a collection of variables of homogeneous types i.e means instead of creating 10 variables to store same type of data let's say marks we create an array that can store 10 elements. Some of the key points about arrays in Go are: Arrays in Go are fixed size Array index starts from 0 Same type of data can be stored in an array Data Type has to be given while the array declaration The syntax for array declaration: //Array declaration var arr [3]int //Indexing the array arr[0]=1 arr[1]=2 arr[2]=3 We can also use shorthand notation for the Arrays //Array declaration and initialization arr1 := [3]int{1, 2, 3} Slices Slices, on the other hand, is a data structure more flexib

Data Types in Go

Image
GOLang Data Types Data types are one of the key things one has to know about while learning a language. They constitute the base of any programming language. I will be covering major data types that any programmer would be using throughout the day while working with GO. Without wasting enough time lets start with GO data types. Basic Types int float32 float64 bool strings derived types Int Ints are used to store 32 or 64 bits integer values defined in GO as follows: var i int = 122 i:=122 The latter syntax is used when we want GO Compiler to pick the data type by inferring the value stored in the variable. Floats Floats are used to store decimal values in Go. Floats can be of two types float32 float64 These two types correspond to the amount of space 32 bytes and 64 bytes respectively to store the numeric values. floats can be created in Go using the following syntax: var f float32 = 1.1 var f64 float64 = 1.1 Bool Bo

Writing first Go program

Image
Introduction Nowadays there is a new buzz word in the IT world i.e  Golang . The need for a highly efficient yet simple programming language has lead to the creation of this new language name Go. As per official  documentation , Go is The Go programming language is an open source project to make programmers more productive.   Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It's a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language. Being an IT professional and in my struggle for constantly updating myself with new tools I started learning Go. I will be sharing my progress by writing blogs on my learnings.

Looping in R

Image
LOOPS in R Loops are part of iterative programming where the user wants to perform a sequence of instructions N number of times. R provides 3 styles of loops: For Loop While Loop Repeat Loop For Loop For loops are used when we want to iterate over a sequence like vectors and or data frames. Syntax: v<-c(10,21,11,31,88,78) for (i in v){       print(i) } This will iterate over all the elements of vector v. For iterating over individual elements using the index one can use sequence vector and use it as index. Syntax: v<-c(10,21,11,31,88,78) for (i  in  1:length(v)){       print(v[i]) } While Loop While loops are used when the iterations depend on a condition and it is difficult to predict the number of iterations. SYNTAX: i<-2 while(i<=10){          print(i)          i<-i+2 } Repeat Repeat is a new construct available only in R to run an infinite loop. Repeat block will iterate until a

Python Interview Questions

Hi Readers, Writing the post after a long time, was looking out for job opportunities. Facing around 10-15 interviews, I have experienced some of the common interview questions asked from a Python Developer and thought of creating a list of these questions. Will create a  separate post for answers as well. Here is the list of interview questions for python interviews: Which version of python have you worked with? What are MAGIC methods? What are DECORATORS? Write a decorator to add a '$' sign to a number. What are the different data types in python? What are mutable and immutable data types? Difference between list and tuples? Which one is faster to access list or a tuple and why? What is list comprehension? What is the use of negative indexing in the list? Why do we need list comprehension? How is it different from creating a list using a loop What are SETS in python? How are they different from LISTS? How SETS are internally stored in python? Which dat

Columnar Database-MonetDB

Image
Hey readers, recently I was exploring one of the databases offering  MonetDB which is a columnar database available open source. As per the documentation, the database has very high read performance and works very well with the data rollups. Apart from this it also supports transactions and other features of transactional databases. In this blog, I will be covering a few things that I learned while exploring the Database. Traditional Transactional DB NO SQL Databases Columnar Databases MonetDB Querying MonetDB using Python Transactional Databases: A decade ago the main purpose of databases was to store info and provide the information as and when required. The operations were mainly write heavy and information was stored in normalized form to avoid redundancy and maintain the integrity of information. The most popular OLTP databases that we have in the market and widely used are : Oracle SQL Server My SQL There are many other opensource as well as c

Pandas - DataFrame

Image
Data Frames In my previous blog , I talked about using the Series Data Structure in Pandas. Feel free to have a  look at that blog. This blog post will be a brief walkthrough of Data Frames. Data Frame is one of the most widely used tool in python by Data Scientists/Analyst. A DataFrame can be considered as a data table. Data Frame provides a wide range of functionality like filtering grouping sorting joins merging Let's start with creating a data frame In [7]: #importing pandas and DataFrame import pandas as pd from pandas import DataFrame #constructor to create a data frame #df=DataFrame( data, index, columns, dtype, copy) #Lists, dict, Series, Numpy ndarrays, Another DataFrame #creating an empty data frame df = DataFrame () #creating a data frame form an array df = DataFrame ([ 1 , 2 , 3 , 4 , 5 , 5 ]) print df 0 0 1 1 2 2 3 3 4 4 5 5 5 In [8]: #