Tuesday 5 October 2021

Introduction to Python for Data Science

What is Data Science?

  • Data Science is the art of analyzing using statistics and machine learning techniques raw data with a perspective of drawing valuable insight from it.
  • Data Science is used in many industries to allow them to make better business and decisions, and in the sciences to test models or theories.
  • This requires process of inspecting, cleaning, modelling, analyzing and interpreting raw data.




Why Using Python?

  • Python libraries provide basic key features sets which are essential for data science.
  • Data Manipulation and Pre-Processing
Python's pandas library offers a variety of functions and data wrangling process


Join us: https://t.me/jupyter_python

Operations On Dataframe in Python [Part II]


Concise summary of Dataframe.


  • So, next we are going to see about how to get the concise summary of DataFrame.

  • So, there is a command called info that returns a concise summary of a DataFrame, the concise summary includes the data type of index; index being the row labels, the data type of row labels is what the output gives as well as it gives the data type of columns, it also gives the count of non-null values.

  • Basically, how many filled values are there in your DataFrame. 

  • Also, it gives the memory usage of the DataFrame and the syntax would be you use the info command along with the DataFrame name.

Syntax = DataFrame.info()












Join us: https://t.me/jupyter_python

Operations On Dataframe in Python

Checking data types of each Column in a Data Frame.


  • If you want to check the data type of each column, because whenever you have been given a data, you want to really check what is the structure of the data; that means, which variable has which data type?
  • In, that case you can use dtypes, because that returns a series with the data type of each column and the syntax would be you use dtypes along with the Data Frame name.
  • So, Data Frame.dtypes will give you a series with the data type of each column

Here is the syntax.

Syntax = DataFrame.dtypes

                                      



Count of unique data types

  • So, now we have an overall idea about what are the data types that we are going to work with using the cars_data. 
  • There is also an option where you can get the count of unique data types available in your Data Frame.
  • So, in that case get_dtype_counts, returns the counts of unique data types in the data frame.


Here is the syntax.

Syntax = get_dtype_counts()





Selecting data based on data types

  • So, now we also have an overall idea about the count of unique data types that we are going to handle with. 

  • So, now, we know about how to get the data type of each variables. So, there might be cases where you want to perform the operations only on a numerical data type.

  • Similarly, there can be cases where you are going to work with only categorical data type.



Here is the syntax.

Syntax = pandas.DataFrame.select.dtypes()












Join us: https://t.me/jupyter_python

Wifi Password Generator in Python


WIFI PASSWORD EJECTOR

Description

  • a simple python script that tells you the password of the wifi you're connected with

Requirements

  • just need to install python in your system.




Source Code:- 

import subprocess

data = (
    subprocess.check_output(["netsh", "wlan", "show", "profiles"])
    .decode("utf-8")
    .split("\n")
)
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
for i in profiles:
    results = (
        subprocess
        .check_output(["netsh", "wlan", "show", "profile", i, "key=clear"])
        .decode("utf-8")
        .split("\n")
    )
    results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
    try:
        print("{:<30}|  {:<}".format(i, results[0]))
    except IndexError:
        print("{:<30}|  {:<}".format(i, ""))



Output:
















Join us: https://t.me/jupyter_python

Monday 4 October 2021

Python Project [ Age_Calculator]


Calculate Your Age!

This script prints your age in three different ways :

  1. Years
  2. Months
  3. Days

Prerequisites

You only need Python to run this script. You can visit here to download Python.



Input:

import time
from calendar import isleap

# judge the leap year
def judge_leap_year(year):
    if isleap(year):
        return True
    else:
        return False


# returns the number of days in each month
def month_days(month, leap_year):
    if month in [1, 3, 5, 7, 8, 10, 12]:
        return 31
    elif month in [4, 6, 9, 11]:
        return 30
    elif month == 2 and leap_year:
        return 29
    elif month == 2 and (not leap_year):
        return 28


name = input("input your name: ")
age = input("input your age: ")
localtime = time.localtime(time.time())

year = int(age)
month = year * 12 + localtime.tm_mon
day = 0

begin_year = int(localtime.tm_year) - year
end_year = begin_year + year

# calculate the days
for y in range(begin_year, end_year):
    if (judge_leap_year(y)):
        day = day + 366
    else:
        day = day + 365

leap_year = judge_leap_year(localtime.tm_year)
for m in range(1, localtime.tm_mon):
    day = day + month_days(m, leap_year)

day = day + localtime.tm_mday
print("%s's age is %d years or " % (name, year), end="")
print("%d months or %d days" % (month, day))



Output :










Join us: https://t.me/jupyter_python

Python Project [Whatsapp Bot]

Whatsapp Bot

Perform Operation like

  1. Put your details
  2. connect with internet
  3. Pass your message

Input:

import pywhatkit
from datetime import datetime

now = datetime.now()

chour = now.strftime("%H")
mobile = input('Enter Mobile No of Receiver : ')
message = input('Enter Message you wanna send : ')
hour = int(input('Enter hour : '))
minute = int(input('Enter minute : '))

pywhatkit.sendwhatmsg(mobile,message,hour,minute)


Output :





Join us: https://t.me/jupyter_python

Python Project [ Digital Clock]


This script create a digital clock as per the system's current time.

Input:



import tkinter as tk
from time import strftime
def light_theme():
frame = tk.Frame(root, bg="white")
frame.place(relx=0.1, rely=0.1, relwidth=0.8, relheight=0.8)
lbl_1 = tk.Label(frame, font=('calibri', 40, 'bold'),
background='White', foreground='black')
lbl_1.pack(anchor="s")
def time():
string = strftime('%I:%M:%S %p')
lbl_1.config(text=string)
lbl_1.after(1000, time)
time()
def dark_theme():
frame = tk.Frame(root, bg="#22478a")
frame.place(relx=0.1, rely=0.1, relwidth=0.8, relheight=0.8)
lbl_2 = tk.Label(frame, font=('calibri', 40, 'bold'),
background='#22478a', foreground='black')
lbl_2.pack(anchor="s")
def time():
string = strftime('%I:%M:%S %p')
lbl_2.config(text=string)
lbl_2.after(1000, time)
time()
root = tk.Tk()
root.title("Digital-Clock")
canvas = tk.Canvas(root, height=140, width=400)
canvas.pack()
frame = tk.Frame(root, bg='#22478a')
frame.place(relx=0.1, rely=0.1, relwidth=0.8, relheight=0.8)
lbl = tk.Label(frame, font=('calibri', 40, 'bold'),
background='#22478a', foreground='black')
lbl.pack(anchor="s")
def time():
string = strftime('%I:%M:%S %p')
lbl.config(text=string)
lbl.after(1000, time)
time()
menubar = tk.Menu(root)
theme_menu = tk.Menu(menubar, tearoff=0)
theme_menu.add_command(label="Light", command=light_theme)
theme_menu.add_command(label="Dark", command=dark_theme)
menubar.add_cascade(label="Theme", menu=theme_menu)
root.config(menu=menubar)
root.mainloop()

Output :







Join us: https://t.me/jupyter_python

Popular Posts

Categories

AI (27) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (114) C (77) C# (12) C++ (82) Course (60) Coursera (176) coursewra (1) Cybersecurity (22) data management (11) Data Science (89) Data Strucures (6) Deep Learning (9) Django (6) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (5) flutter (1) FPL (17) Google (19) Hadoop (3) HTML&CSS (46) IBM (25) IoT (1) IS (25) Java (92) Leet Code (4) Machine Learning (44) Meta (18) MICHIGAN (5) microsoft (3) Pandas (3) PHP (20) Projects (29) Python (741) Python Coding Challenge (191) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (40) UX Research (1) web application (8)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses