# -*- coding: utf-8 -*-
"""
Created on Fri Apr  8 18:13:59 2022

@author: TANISH
"""

""" Quick Tips """

# Data Types
Dictionary: Create / Modify {}
Dictionary.keys()
Dictionary.items()

Set: Create set()
List: Create / Modify []


# Functions
value_counts()
pivot()
np.arange()
range()
sorted(reverse = )
isnull()
sort(reverse = )
groupby()
fillna()
dropna()
lambda()
def()
astype()
describe()
argmax()
argmin()


# Topics
Feature Scaling
Feature Selection (Forward, Backward)

# Linear Regression
model.score_
model.coef_


# Working with dates
import pandas as pd

df = pd.read_csv(r"C:\Users\tanis\Desktop\Dates.csv")

df.info()

df["Date"] = pd.to_datetime(df["Date"], 
                             format = "%Y-%m-%d") 


# %Y : Year WITH century, like 2020
# %y : Year WITH century, like 2002 as 02

# How to change Date format
# Syntax: strftime(required format)

df.["Date"].strftime("%Y-%m-%d")



# For more variations, Refer:
# https://towardsdatascience.com/everything-you-need-to-know-about-date-formatting-in-3-minutes-d7f3d53beea


# List comprehension
# Makes it easy to create a list based
# on for loops

# Eg:
# Given a list, retain only the
# positive no.

data = [-1,5,10,-4,-3,21]

data = [i for i in data if i >= 0]


# Instead,

data = [-1,5,10,-4,-3,21]
new = []

for i in data:
    if(i >= 0):
        new.append(i)
        