Home Blog Page 43

Top Best Libraries in Python which makes development easy

0
Libraries in Python
Libraries in Python

In this Python Article, we are going to discuss on Python standard libraries and libraries that are very useful libraries in python.

What are Python Library

Basically a Library is collection of different module, package and API that allow us to use it repeatedly in python programs. It Make programming development faste, simple and easy to learn and implement.

Top Python Libraries: –

  1. Pandas
  2. Numpy
  3. Scipy
  4. SciKit Learn
  5. Keras

1. python pandas

 Pandas is an open source Library used for data analysis in python that provide high performance data manipulation.

Used for Data analysis because during the analysis require lots of processing like construction, cleaning, Merging etc.

Features :-

  1. Pandas is fast and simple compare to other tool
  2. Pandas is built on top of the Numpy package, means Numpy is required for operating the Pandas.
  3. Used for handling missing data
  4. Provide functions to work with Time Series.
  5. Customized Indexing
  6. Easily reshape data
  7. Easily work with slicing, indexing, filtering, GroupBy

Data Structure of Pandas: –

  1. Series
  2. Dictionary

Series: –

Series is one Dimensional array of any Datatype Without duplicate values. Series Connected with the index.

We Can easily convert list, Tuple, Dictionary into Series Using the inbuilt method series ().

#creating a Series Using Array:-
Import numpy as np
Import pandas as pd
Data = np.array([‘one’, ‘three’, ‘five’, ‘eight’, ‘ten’])
s = pd.Series(Data)
Print(s)
Dictionary :-

Dictionary is a two dimensional array with indexes  i.e. column and row and axes. Dictionary can be created using {}.

# Creating a Dictionary: - 
Import pandas as pd
s = [‘one’, ‘two’,’three’,’four’]
df = Pd.DataFrame(s)
Print(df)

2. python numpy

“Numerical Python” is defined by the term “NumPy.” Numpy   is an open source Library used for mathematical purpose in python that provide high Number of method to work with data.

Numpy also use with packages like Scipy and Matplotlib

Attributes of Numpy is shape, ndim, flags.

python numpy logo

Features of numpy: –

  1. It is a user friendly library.
  2. Can understand coding easily.
  3. Useful for Machine Learning UseCases.

3. python scipy

Scipy is an open source scientific library used for solving mathematical, scientific and Technical Problems. Scipy built top on python Numpy Extension.

It contains different sub package that help to solve scientific problems.

It Operate on Numpy Library.

Some Sub Package has Shown Below:-

Sub packageDescription
scipy.ioused for data input and output.
scipy.optimizeUsed for optimization
scipy.statsUsed for Statistics
scipy.signalUsed in single analytics.
scipy.specialSpecial Functions

4. Python SciKit Learn (Sklearn)

Scikit-learn is the useful library for machine learning in Python. It provide tools for machine Learning and Statistics algorithm.

Scikit-learn built upon NumPy, SciPy and Matplotlib.

It Supports algorithm like KNN, random forest, Support Vector Machine (SVM).

python sklearn

Features of sklearn :-

  1. Machine Learning Algorithm:- Support almost all Supervised and unsupervised machine Learning algorithm
  2. Clustering:- Used for grouping unlabeled Data.
  3. Cross validation:- used to Check accuracy of Supervised Model.
  4. Feature Extraction:- Used to Extract  features from Row Data.
  5. Feature Selection:- Identify useful attributes to built machine Learning Model
#Examples :-
First need to Install Scikit Learn Library by following command:- 
pip install -U scikit-learn

Import scikit learn Using Following Line:- 
from sklearn import datasets

5. Python Keras

Keras is Open Source Python Library for developing deep learning models.

It use for Numerical Computation.

The Theano and TensarFlow libraries help to define and train neural Network models in few lines of code  

Keras runs on top of open of ML Library Like TensorFlow, Theano or Cognitive Toolkit (CNTK).

Features :-

  • Easy to Understand concepts.
  • It supports prototyping.
  • It runs on Both CPU as well as GPU.
  • It is really very simple to get started with.
  • Easy production of models actually makes Keras special.

Keras has three backend engines, which are as follows:

Tensor Flow:-

     Tensor Flow is an open source library used for machine learning and artificial intelligence. Also useful for developing deep learning applications

Theano
Theano is a Python library that help to Work with  mathematical expressions in Machine Learning, It can rival typical full C-implementations in most of the cases.

Microsoft Cognitive Toolkit

It is a open Source library use for to create machine learning prediction models. It contains basic building blocks, which are required to form a neural network. The models are trained using C++ or Python.

How to implement flutter liquid swipe for onBoarding introduction screen

0
Flutter Liquid Swipe Introduction Screen
Flutter Liquid Swipe Introduction Screen

Hi Guys, Welcome to Proto Coders Point. In this flutter tutorial will learn how to implement flutter liquid swipe screen which is a similar to any onboarding welcome sceen in flutter.

Liquid Swipe in flutter

Video Tutorial

Flutter Liquid swipe video tutorial with example

The flutter liquid swipe is a amazing animation swipe stacked widget, that provide liquid animation while switching/swiping between pages.

By using flutter liquid swipe widget library we can create onboarding screen / welcome intro screen or we can say it as introduction screen in flutter for introviews.

So this flutter widget i.e liquid swipe can be used to create & design a beautiful app welcome screen in flutter, that we can show to a user only once when he launch the applicaton for he very first time to explain user about the app & how to use it. it will be like introguide for user.

Let’s get started

Thus, now we know about this flutter widget let’s begin adding liquid swipe introduction screen in flutter.

Flutter onBoarding screen using liquid swipe widget

Step 1: Create a flutter project

Create a new flutter project or open a existing flutter project where you want to implement liquid swipe library for adding app welcome screen in flutter.

I make use of android studio to develop flutter application

File > New > New Flutter Project

create by filling all the app details.


Step 2: Install liquid swipe dependencies

Now, To install dependencies, goto pubspec.yaml file & under dependencies section add…

dependencies:
  liquid_swipe:

After adding, click on 'pub get', it will download the library as external libraries else run flutter pub get in terminal.


Step 3: Import liquid swipe package

Now, you need to import liquid_swipe.dart file where required eg: main.dart.

import 'package:liquid_swipe/liquid_swipe.dart';

add the import statement in main.dart page on the top.


Properties of flutter liquid swipe widget

PropertiesDescription
pages:List of pages or screen, that you want to show onboarding
initialPage:Default initial page, from where the first pagee start “0”
enableSideReveal:Reveal slight view about next page, so that user can understand he can swipe, set to true or false.
enableLoop:set to true or false, if you want keep page loop through pages.
slideIconWidget:display a swipe indication, you can add a Arrow icon.
liquidController:To handle some runtime changes by users.
onPageChangeCallback:this finction will get triggered each time when changes occur.

Read more on official document flutter liquid swipe.


How to use Liquid Swipe Widget

final pages = [
    Container(...),
    Container(...),
    Container(...),
  ];

Above we have just defined a array of pages, that contains list of Container Widget.

Now you just need to use this array pages in LiquidSwipe widget as below.

 @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: Builder(
          builder: (context) =>
              LiquidSwipe(
                  pages: pages
              )),
    );
  }

Complete Source Code – How to implement Liquid Swiper in flutter

main.dart

import 'package:flutter/material.dart';
import 'package:liquid_swipe/liquid_swipe.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: LiquidSwipe(
        enableSideReveal: true,
        slideIconWidget: const Icon(
          Icons.arrow_back,
          color: Colors.white,
        ),
        pages: [
          Container(
            color:Colors.black,
            child: Center(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Center(child: Image.asset('assets/logo.png')),
                  Text('Welcome to \'\n\' Proto Coders Point',style: TextStyle(color: Colors.white,fontSize: 25,fontWeight: FontWeight.bold),)
                ],
              ),
            ),
          ),
          Container(
            color:Colors.pink,
            child: Center(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Center(child: Image.asset('assets/logo.png')),
                  Text('Learn Application \'\n\ Development Here',style: TextStyle(color: Colors.white,fontSize: 25,fontWeight: FontWeight.bold),)
                ],
              ),
            ),
          ),
          Container(
            color:Colors.green,
            child: Center(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Center(child: Image.asset('assets/youtube.png')),
                  Text('Subscribe us now ',style: TextStyle(color: Colors.white,fontSize: 25,fontWeight: FontWeight.bold),)
                ],
              ),
            ),
          ),
        ],
      )
    );
  }
}

output

Python Data Structure – Build In & User defined

0
Data Structure in Python
Data Structure in Python

Hi Guys, Welcome to Proto Coders Point. In this Article. We will look into the Python Data Structure that help to understand python in deep.

Data structures are containers that organize and group data according to the Data Type

Types of data structure in python

There are 2 Types of Data Structure in Python:-

  1. Built-in Data Structure
  2. User Defined data  Structure

Python built in data structures

The Python built-in data structures are 

  • list
  • set
  • tuples
  • and dictionary.

1) List :-

List is sequence Datatypes in Python. Lists are used to store multiple Heterogeneous elements in a single variable. List is Mutable so we can modify and add the elements in the Present List.

List are represented in square Brackets []. It Support Slicing and Positive and Negative indexing.

Now we will see how we can perform operation on list.

Examples :-

#Integer Elements 
list1 = [10,20,30]
list1
my_list =[] 
#list With Heterogeneous Elements 
mix_list = [10, ‘Hello’, 10.5, 20]
mix_list

Access a List Using Slicing and Indexing or Negative Indexing

li = [10,20,30,'a','b',20.5,'c',30.20]
print(li[2]) # Output – 30
print(li[4]) # Output – b

Negative Indexing 
print(li[-1]) # Output – 30.20
print(li[-2]) # Output – 10.5

Nested Indexing
nest_list = [5,6,8,[9,7,2],3]
nest_list[2]            # Output – 8
nest_list[3]            # Output - [9, 7, 2]
nest_list[3][1]         #Output  - 7


2) Set :-

Set are a collection of elements that can be mutable, iterable. Set is used to store multiple elements in a single element.

Set are mutable.

Cannot accept duplicate Values.

Does not support for indexing

Some Built in Method for Sets

  1. add ()
  2. clear ()
  3. copy ()
  4. difference ()
  5. discard ()
  6. pop ()
  7. remove ()
  8. update ()

Examples:-

Set can create by using dictionary, list.
#Dictionary 
set_ds = {5,10,15,15}
#Output -> {5, 10, 15}
set_ds = {10, (8, 1.5, 3), 'new'}
#Output -> {(8, 1.5, 3), 10, 'new'}
#List
set_list = [5,9,2,36,4,5]
type(set_list) #Output :- list
set(set_list) #Output :- {2,4,5,9,36} (Remove Duplicate Element and Print Element)

3) Dictionary

Dictionary is collection of items, python Dictionary are used to store the value in the form of key value pair, python Dict are created using curly braces {} separated by commas.

Dictionary Item are represented by key value pair.

Built-in Methods of py dict:-

  • clear()  –> Use to Clear elements from the dictionary.
  • copy()  –> Returns a new  copy of the dictionary.
  • items()  –> Return a new object in key value format
  • keys()   –> Returns a dictionary keys
  • values()   –> Returns a dictionary’s values
#Examples :-
# dictionary with integer keys
my_dict = {1: 'water', 2: 'Bottle'}

my_dict = {'name': 'John', "age": 20}
print(my_dict[‘name’]) 
# Output:- John

# using dict()
my_dict = dict({1:'apple', 2:'ball'})

4) Tuple :-

Python Tuples is sequence Data Types that help to store multiple elements in one variable. It is Similar to the List but tuple has certain restriction like :-

Tuple are immutable. So We cannot change or modify elements from tuples.

Tuples  are declared using () parenthesis

Accessing Tuples:-

There are certain ways that we can access Tuples .

  • Indexing

Used index operator [] to access an element in a tuple,

The index starts from 0.

  • Negative Indexing:-

a. Python allows negative indexing for its sequences.

b. The index of -1 refers to the last item, -2 to the second last item and so on.

Examples:-

# Tuple having integers
new_tuple = (1, 2, 3)
print(new_tuple)
Output - (1, 2, 3)

# tuple with  datatypes
new_tuple = (1, 2, 3, 'new', 10.20)
print(new_tuple)
Output - (1, 2, 3, 'new', 10.20)

# nested tuple
new_tuple = ("bat",(1, 2, 3), [4,5,6])
print(new_tuple)
Output - ("bat",(1, 2, 3), [4,5,6])

Accessing the Tuples:- 
new_tuple = (1,6,8,9,10,6,87,9,2,3,6)
print(my_tuple[0])   # 1
print(my_tuple[5]) #6
			
print(my_tuple[-5]) #87

Python list to tuples example

For Converting list to tuple we have use inbuilt method i.e.tuple()
list_ex = [10,20,30]
print(list_ex) 

#output :- [10, 20, 30]
tupl_ex = tuple(list_ex)
print(tupl_ex) 

#Output :- (10, 20, 30)

Python User defined Data Structure

  • Linked List
  • Stack
  • Queue
  1. Linked List

A linked list is a order of data Component, which are connected which each other using links. Each data component available with connection to another data component in form of a pointer.

2. Stack

A stack is a linear data structure that stores elements in LIFO or FILO manner.
In stack, a new elements is add at the end and element remove from end only.

For Adding elements we called PUSH & removing elements called POP.

LIFO :- Last In First Out
FILO :- First In Last Out

3. Queue

A Queue is a linear data structure that stores elements in FIFO(First In First Out) manner.
For Adding elements we called Enqueue & removing elements called Dequeue.

  • Operations:-
    1. Enqueue :- Add element in Queue.
    2. Dequeue :- Remove the element in Queue.
    3. Front :- Get the First Element.
    4. Rear :- Get the Last Element.

Flutter Introduction – Powerpoint presentation flutter ppt download

0
Flutter Intro ppt
Flutter Intro ppt

Hi Guys, Welcome to Proto Coders Point. This Atricle will be on Introduction to flutter with free to download flutter ppt.

Building Mobile application has lots of scope in coming days because mobile industry is growing rapidly, now every one in this world has atleast one mobile in hand, not only elder people even small kids are now using mobile to entertain them by using some kind of mobile application.

You may find many framework using which you can develop application, Like Android is a native framework that uses java/kotlin and iOS framework tht uses Objective-C/Swift Language.

So to just native application for different Operating System, In old days we used to code twice/thrice different languages to host our application of Android/iOS/Web.

But now with Flutter we can code only once and distribute on all the platform by using creating respective build version.

Flutter Introduction

Flutter is framework created by google. A cross-platform framework used to develop application for:

  • Android
  • iOS
  • Web
  • and Desktop

To build flutter application we make use of Dart Programming language which is also been created by google itself.

Why Flutter for App Development

1. Flutter open source: Flutter is Open-Source framework. Therefore, anyone can use it for any given purpose.

2. Faster development Cycle: Flutter is so fast that it takes less then 30 sec for first full compilation. Comes with Hot-Reload & Hot-Restart.

3. Super Productive: Comes with Hot-Reload & Hot-Restart. Due to Stateful widget hot-reload feature Flutter is very fast iterative coding style.

4. Ease to learn & code sharing: Any one who have basic knowledge of OOPS Concept & UI Designing can easily learn Flutter.

5. Widget Libraries: Ready to use widget, Flutter have many widget that you can use to build flutter application.Such as : http, get, share plus, toggle switch etc.

6. Community Support: Flutter Community is bit small if we compare with other framework like React, But Flutter is grow very fast then other framework.

Apps that are build using Flutter

flutter showcase

1. Dream 11

dream11 flutter
dream11 flutter

2. eBay

flutter ebay app
flutter ebay app

3. Stadia gaming platform.

stadia flutter app
stadia flutter app

4. Google Pay – UPI Payment App

flutter google pay app
flutter google pay app

Feature of Flutter

  • Cross Platform App Development.
  • Easy access to Native Features.
  • Minimal Coding.
  • Fast Development
  • Hot Reload & Hot Restart

Flutter Powerpoint presentation ppt

Download introduction to flutter ppt for below button.

Check out the same ppt slides on Flutter slideshare.

Python MySql Database connection

0
python mysql connector
python mysql connector

Hello Guys, Welcome to Proto Coders Point. In this tutorial will discuss regarding python mysql connector i.e how to connect Mysql database using Python mysql connector Module.

MySql WorkBench Setup

First we will setup MYSQL WorkBench by creating the Database, For this we are going to use MYSQL WorkBench for Working with Database.

I have already created a Database so we can connect directly to database. Follow the below steps:

  • Open MYSQL WorkBench Application. Go to Database and Click on Connect To Database
  • Fill all details that are shown below like Hostname, Port no, userName and click on OK if password no credential added.

Otherwise if you add password Credential for Database connectivity, Then Follow Steps: –

  • Add Connection Details(hostName, Port, UserName) etc as before.
  • Click on Store in Vault…
  • Enter the password and Click OK

After successfully connection with database you will get Query Windows for work with SQL Query.

Query 1: show databases;

Query 2: Use inc ; //inc is my database name.

Query 3: select * from user_details;

We successfully done with the MYSQL Connection, Now we have to Access by using Jupyter Notebook.

So with this you need to Install MySQL Installer.msi file and Jupyter Notebook else You can use different IDE with execution like Pycharm, Python IDLE.


How to connect and fetch mysql database in python

1. Import mysql.connector Module :

python mysql.connector Module that enable the access of MYSQL Database .

To Create a Connection with MYSQL and Python, Use Connect() method of mysql.connector Module and then add the details with connection like Host IP, UserName, Password & Database Name, refer below snippet code for the same.

import mysql.connector
if __name__ == "__main__":
    connection = mysql.connector.connect(host='localhost',
                                         database='inc',
                                         user='admin',
                                         password='amazon123')

Code Screenshot Example:

If MYSQL Installer is not available in your System then it will display ModuleNotFoundError like.

So you need to download and install MYSQL Installer .msi file

Link :- https://dev.mysql.com/downloads/connector/python/


2. Create Cursor() object :

The MySQLCursor of mysql-connector-python is used to execute statements to communicate with the MySQL database. and creating cursor object to perform SQL CRUD operation.

import mysql.connector
if __name__ == "__main__":
    connection = mysql.connector.connect(host='localhost',
                                         database='inc',
                                         user='admin',
                                         password='amazon123')
    
    cur = connection.cursor()
    print(cur)

#OUTPUT
CMySQLCursor: (Nothing executed yet)

3. Execute the Query using execute()

The execute () methods run the SQL query and return the result provided by database data response.

use cursor.fetchall() or fetchone() or fetchmany() to read query result. This method executes the given database operation. The parameters found in the tuple or dictionary are bound to the variables in the operation.

cur.execute("select * from user_details")
data=cur.fetchall()
#print(data)

for i in data:
print(i)
#OUTPUT

Complete Source Code – Python Program To fetch data from MySQL Database

import mysql.connector
if __name__ == "__main__":
    connection = mysql.connector.connect(host='localhost',
                                         database='inc',
                                         user='admin',
                                         password='amazon123')

cur = connection.cursor()
cur.execute("select * from user_details")
data=cur.fetchall()
#print(data)

for i in data:
print(i)

Output of above python sql program :-


How to install docker on ubuntu AWS server

0
Install Docker on Ubuntu
Install Docker on Ubuntu

Hi Guys, Welcome to Proto Coders Point. In this artcile let’s learn basic about docker & how to install docker ubuntu server – the easiest way.

Before we start, Let under what docker is exactly.

What is docker?

A Docker is a platform basically used for developing, running a application & easily shipping application file. Docker help developer to pack their application into a docker container so that it wil be easily to transfer application to other system. A docker container image include all the required dependencies to execute your code on any machine.

What is docker container?

A Container in docker is executable package of application source code with operating system libraries & the dependencies that required to run code in any envirnoment.

Advanctage of implementing docker

By using docker, it reduce the effort & errors that usually occurs while deploying our code from local to server.

Docker provide rapid delivery & reduce the deployment time as it is very lightweight & minimal overhead.


How to install docker on ubuntu server – AWS

There are various way to install docker on ubuntu like using repository or by using script from get.docker.com

Follow below steps to install docker.

Installing docker using repository

1. Update apt package

sudo apt-get update

install curl, gnupg, lsb-release, ca-certificates

sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

2. Add docker GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
docker gpg key command

3. Set-Up docker stable repository

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

4. Installing docker Engine

a. Update apt again

sudo apt-get update

b. Install docker on ubuntu

Now install current latest version of docker 20.10.12 & docker cli and containerd.io

sudo apt-get install docker-ce docker-ce-cli containerd.io
install docker
install docker cli

c. Check for installed version

Now check if docker was sucessfuly installed by checking docker version

docker --version
docker version check
docker version check

d. Verify if docker working

Now let’s run docker command to execute “hello-world” docker image container.

sudo docker run hello-world

The above command, will search for hello-world in local, if not found then it downloads offical text image of hello-world from docker site & run it in container, when container execute it prints the message helloworld & exit.

docker hello world image
docker hello world image

There we have successfully installed docker in ubuntu server.



How to uninstall docker from ubuntu

1. First Step unistall docker engine, cli and container packages:

sudo apt-get purge docker-ce docker-ce-cli containerd.io

2. After uninstalling, docker image, container and other docker config on your local host will not automatically get deleted, we need to remove them manually, if we want a freshly uninstall docker. run below rm commands

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd