Skip to content

Instantly share code, notes, and snippets.

View adityajn105's full-sized avatar

Aditya Jain adityajn105

View GitHub Profile
@adityajn105
adityajn105 / hypothesis_testing_demo_datalit_week_2.ipynb
Last active April 26, 2019 07:28
Hypothesis_Testing_Demo.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adityajn105
adityajn105 / pandas.md
Last active December 4, 2018 05:47
Pandas Fundamentals and Advanced

Axis in Dataframes

  1. Axis 0 means along row ( for a particular feature of all samples ) |/
  2. Axis 1 means along columns (of a particular sample for all features ) --->
  3. Remember this by a matrix 2x3 matrix. Here axis 0 has length 2 and axis 1 has length 1

Groupby

  1. Perform aggregation on one or more than one columns
  2. If more than one column in used then it is considered as multi-indexing

df.groupby( columns ).colname.aggfunc()

@adityajn105
adityajn105 / Helloworld.scala
Created November 1, 2018 11:45
A tutorial to quickly revise Scala syntax and features
/*
* Scala - Scalable Language, hybrid functional Programming language
* Integrates features of OOP and functional languages
* Compliled on JVM
* Can use all classes of JAVA SDK and also own custom classes
* Some different features from JAVA
* 1. All types are objects
* 2. Tpye inference
* 3. Nested Functions
@adityajn105
adityajn105 / policy_iteration.py
Last active October 18, 2018 11:08
Policy Optimization using policy iterations and value iterations.
"""
Author : Aditya Jain
Contact: https://adityajn105.github.io
"""
import gym
import numpy as np
#create game
game = gym.make('FrozenLake-v0')
#get game env object
@adityajn105
adityajn105 / competitions_tips_templates.md
Last active April 26, 2022 03:02
Useful programming templates implemented in python 3

General Snippets

1. Prime Factors of a number

  • Step1 : divide number by 2 and add 2 as factor till possible
  • Step2 : Start k from 3 with step of 2 till sqrt(number), divide number by k and add k as factor till possible
  • Step3 : Check if number remaining is greater than 1, add that number as another factor.
def getPrimeFactors(n):
    factors = []
    while n%2==0:
        factors.append(2)
@adityajn105
adityajn105 / basics.md
Last active November 11, 2020 04:19
Important Python Functionalities and Libraries

1. lambda Function

It is an anonymous function which can be used as a parameter function with sorted/sort,bisect,map,filter,reduce

>> lambda x: x*2;
>> lambda (x,y) : x+y

2. map

It is used to perform some operations on all items of sequence in one line and get a map object is iterable and can be converted to sequence

@adityajn105
adityajn105 / basic_sql.txt
Last active September 4, 2021 08:08
Basic SQL and Mongo DB
SQL COMMANDS TYPE
1. DDL (Data Definition Language)
Data Definition Language, DDL, is the part of SQL that allows a database user to create and restructure database objects,
such as the creation or the deletion of a table.
CREATE TABLE, ALTER TABLE, DROP TABLE, CREATE INDEX, ALTER INDEX, DROP INDEX, CREATE VIEW, DROP VIEW
2. DML (Data Manipulation Language)
Data Manipulation Language, DML, is the part of SQL used to manipulate data within objects of a relational database.
INSERT, UPDATE, DELETE
3. DQL (Data Query Language)
SELECT
@adityajn105
adityajn105 / colab_important_snipplets.py
Last active September 19, 2020 12:11
Google Colab important code snipplets
### Download a file to Local System from Colab
from google.colab import files
with open('example.txt', 'w') as f:
f.write('some content')
files.download('example.txt')
#======================================================================================================
#upload file to Colab from Local System
from google.colab import files
uploaded = files.upload()
@adityajn105
adityajn105 / README-Template.md
Created July 17, 2018 08:39 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@adityajn105
adityajn105 / Readme.md
Last active November 7, 2019 07:14
Readme.md Template

Markdown Cheatsheet


Heading 1

Markup :  # Heading 1 #

-OR-