Posts

DAY 13 - Connect to Oracle DB Using Python Script

DAY 13 - Connect to Oracle DB Using Python Script Step 1 : Install Libraries# Pandas & cx_Oracle  in Command Prompt Refer this blog to install libraries in your system. https://dsbyrr.blogspot.com/2019/10/steps-to-prepare-your-windows-laptop.html Step 2 : Execute the below script in Python IDLE by passing Oracle DB Connection Details import cx_Oracle import pandas as pd connection = None try:     #Oracle DB Connection Details         username = 'p_user_name'     password = 'p_password'     dsn = 'hostname:port_number/service_name'         connection = cx_Oracle.connect(         username,         password,         dsn)         # show the version of the Oracle Database     print(connection.version)         cur = connection.cursor()     cur.execute("select * f...
Image
DAY 12 - INDIA COVID-19 TRACKER IN POWER BI  I have created COVID-19 INDIA tracker in POWER BI. Kindly have a look and provide your valuable feedback.   I am also creating INDIA COVID-19 TRACKER in Public Tableau so that you can access it and also get the feel of fully interactive Dashboard. You'll get data-set  from multiple websites. Just get the flat files from any one of these public websites. Step 1: Use python to do data cleansing and make sure to create a data-set                       named - INDIA-COVID-19 which is having these 5 columns (i.e.                                 State,Confirmed,Active,Recovered & Death)  Step 2: Load this data-set in Power BI  Step 3:  Create below mentioned 5 pages in Power BI              a) Dashboa...

DAY 11 - Organize a Secret Santa Game in your organization using a Python Script

DAY 11 - Organize a Secret Santa Game in your organization using a Python Script Secret Santa Rule: ################## The basic concept of the Secret Santa game is simple. All of the participants’ names are placed into a hat, box, etc. and mixed up. Each person then chooses one name from the box, but doesn’t tell anyone which name was picked. He/she is now responsible for buying a gift for the person selected. When the Secret Santa wraps his/her gift, he/she should label it with the recipient’s name but doesn’t indicate whom the present is from. (Remember, most of the fun is in the secrecy.) All the gifts are then placed in a general area for opening at a designated time. When the gift-giving time arrives, each recipient finds his/her gift and must guess who their Secret Santa is. If they can’t guess, their Secret Santa eventually confesses. Gone are the old days when we used to ask each particpant to pick a name from the box. Now it's a digital world. So it is wise to h...

DAY 10 - Python Program to Print the Pascal’s triangle for n number of rows given by the user

DAY 10 - Python Program to Print the Pascal’s triangle for n number of rows given by the user It's the very basic problem statement in python. Following is an 5 level Pascal's triangle: Sample Input: 5 Sample Output: [1] [1, 1] [1, 2, 1] [1, 3, 3, 1] [1, 4, 6, 4, 1] Solution: import pandas as pd import numpy as np n=int(input("Enter number of rows: ")) nested_list = [] for i in range(n):     k = 0     nested_list.append([]) # keep on adding a new list in each iteration of i     for j in range(i+1):         #keep on appending list[i]         if i <=1: # logic for 1st and 2nd list            nested_list[i].append(1)         else: # logic for 3rd list onwards             if j == 0: # fisrt element of list[i]                 nested_list[i].append(1)      ...

DAY 9 - Web Automation Using Python Script

DAY 9 - Web Automation Using Python Script Example 1: Login to Instagram Step 1:  Follow steps mentioned in DAY 1 - Blog to install library - selenium,xlrd,xlwings https://dsbyrr.blogspot.com/2019/10/steps-to-prepare-your-windows-laptop.html Step 2: Download Chrome driver from URL: https://chromedriver.storage.googleapis.com/index.html?path=78.0.3904.105/ Step 3: Create a file say Insta_login.py and save it at Desktop from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import Select from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as ec from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver.common.action_chains import ActionChains import xlrd import xlwings as xw try:     capabilities = {         'browserName': 'chrome', ...

DAY 8 - Image To Text And Image To Audio Using Python Script

Image
DAY 8 - Image To Text And Image To Audio Using Python Script 1. open a python file from desktop and execute it in python IDLE. That's way, next file will be picked from Desktop by default. That's my personal experience. Please do this step as a prerequisite 2.  Install these libraries using below commands.     Open command prompt and move to path "C:\Users\Rakesh.Ranjan\AppData\Local\Programs\Python\Python37-32\Scripts>" and then execute below commands       >>> pip install pytesseract ## will convert the image to text string     >>> pip install googletrans ## google translator library     >>> pip install gTTS        ##Text To Audio 3. # import the following libraries # will convert the image to text string import pytesseract      # adds image processing capabilities from PIL import Image #translates into the mentioned language from googletrans imp...

DAY 7 - Text To Audio And Audio To Text Using Python Script

 Text To Audio And Audio To Text Using Python Script #Text To Audio using Python Script ############################################## 1. Install gTTS using below command: Open command prompt and move to path "C:\Users\Rakesh.Ranjan\AppData\Local\Programs\Python\Python37-32\Scripts>" and then execute below command to install gTTS pip install gTTS 2. >>> import sys    Using the command to know path variables    >>> sys.path    Audio file will be saved at one of these paths 3. #module for text to speech conversion from gtts import gTTS mytext = 'Welcome to India, Mr Mike !' #command to convert text to audio myobj = gTTS(text=mytext, lang=language, slow=False) #saving the file in mp3 format myobj.save("WelcomeFile.mp3") 4. Steps to find the file location import os.path from os import path >>> path.exists("WelcomeFile.mp3") True >>> path.realpath("WelcomeFile.mp3") ...