Found 33676 Articles for Programming

How to build your own Sqlite database in Python

S Vijay Balaji
Updated on 11-Feb-2021 06:29:59

704 Views

IntroductionBeing a programmer it is essential to learn to use databases in our applications to store, retrieve, manipulate, and delete data with ease. Python comes with the SQLite package preinstalled with it, using which we can create and manipulate SQLite databases.SQLite databases are written in a single file and are hence are easier to use and access. You can easily manipulate the data within and hence is very easy for data analysis. It is very simple and easy to setup and use.Getting StartedNow that you know, what SQLite is and why we use it, let us get started with how ... Read More

How can Tensorflow be used to visualize the flower dataset using Python?

AmitDiwan
Updated on 19-Feb-2021 17:28:42

256 Views

The flower dataset can be visualized with the help of the ‘matplotlib’ library. The ‘imshow’ method is used to display the image on the console. The entire dataset is iterated over, and only the first few images are displayed.Read More: What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?We will be using the flowers dataset, which contains images of several thousands of flowers. It contains 5 sub-directories, and there is one sub-directory for every class.  We are using the Google Colaboratory to run the below code. Google Colab or Colaboratory helps run Python code over the ... Read More

How can Tensorflow be used to load the flower dataset and work with it?

AmitDiwan
Updated on 19-Feb-2021 17:24:46

200 Views

We will be using the flowers dataset, which contains images of several thousands of flowers. It contains 5 sub-directories, and there is one sub-directory for every class.  Read More: What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?Once the flower dataset has been downloaded using the ‘get_file’ method, it will be loaded into the environment to work with it. The loader parameters are explicitly mentioned and the loaded data is split into training and validation set.We are using the Google Colaboratory to run the below code. Google Colab or Colaboratory helps run Python code over the ... Read More

How can Tensorflow be used to download flower dataset into the environment?

AmitDiwan
Updated on 19-Feb-2021 17:20:43

406 Views

The flower dataset can be downloaded using a google API that basically links to the flower dataset. The ‘get_file’ method can be used to pass the API as a parameter. Once this is done, the data gets downloaded into the environment.Read More: What is TensorFlow and how Keras work with TensorFlow to create Neural Networks?We will be using the flowers dataset, which contains images of several thousands of flowers. It contains 5 sub-directories, and there is one sub-directory for every class.  We are using the Google Colaboratory to run the below code. Google Colab or Colaboratory helps run Python code ... Read More

How to build a simple GUI calculator using tkinter in Python

S Vijay Balaji
Updated on 11-Feb-2021 06:27:57

872 Views

IntroductionIn Python, we use the tkinter library to create GUI components and craft better user interface.In this article you will learn methods to build a simple GUI based calculator application.Getting startedBefore we jump into it, there are a few things we need to get organised first.Let us start by downloading Python’s imaging library that we will be using to get images from our local system. In order to install PIL(Pillow), launch you terminal and type the command below.pip install PillowNow that you have the package installed. You will have to download icons needed for the calculator.You can go on Google ... Read More

How to access and convert time using the time library in Python

S Vijay Balaji
Updated on 11-Feb-2021 06:19:16

440 Views

IntroductionThe time library in Python is used to obtain time in the real world and perform various tasks related to it. You can even manipulate execution time using this module.Getting StartedThe time module comes packaged with Python. This means you do not have to install it separately using the PIP package manager.In order to use its various functions and methods, you must first import it.import timePrinting current local timeIn order to print the current local time, we will be using the ctime() function.But firstly, we must obtain the number of seconds since epoch. That is, the number of seconds since ... Read More

Documentation generation using the pydoc module in Python

S Vijay Balaji
Updated on 11-Feb-2021 05:53:24

7K+ Views

IntroductionThe pydoc module automatically generates documentation from Python modules. The documentation can be saved as pages of text on the console, displayed on the web browser, or even as HTML files.In this article you will be learning methods to view these documentations in various cases and even learn about docstrings that help you create your own documentation for your python scripts.Now that you know the use of pydoc, let us get started.Getting StartedThe pydoc module comes packaged along with Python, which means you don’t have to download and install it separately.In order to access pydoc, you can must first import ... Read More

Copy and paste to your clipboard using the pyperclip module in Python

S Vijay Balaji
Updated on 11-Feb-2021 05:50:08

2K+ Views

IntroductionWe will be using the pyperclip module in order to copy and paste content to the clipboard. It is cross−platform and works on both Python 2 and Python 3.Copying and pasting from and to the clipboard could be very useful when you want the output of the data to be pasted elsewhere in a different file or software.Getting StartedThe pyperclip module does not come packaged with Python. In order to access it, you must first download and install it. You can do this using the PIP package manager.Launch your terminal and type the command below to install pyperclippip install pyperclipOnce ... Read More

Accessing the internet using the urllib.request module in Python

S Vijay Balaji
Updated on 11-Feb-2021 05:46:33

553 Views

IntroductionWe use the urllib.request module in Python to access and open URLs, which most often use the HTTP protocol.The interface used is also very simple for beginners to use and learn; it uses the urlopen function which can fetch various URLs using a variety of different protocols.You will get a better understanding of what we are working with, once we start using its various functionalities. So, let us get started.Getting StartedThe urllib library comes packaged along with Python. So, you do not need to install it separately, but in case you want to add it to your environment and you ... Read More

Write a Python program to sort a given DataFrame by name column in descending order

Vani Nalliappan
Updated on 24-Feb-2021 07:21:58

636 Views

Input −Assume, sample DataFrame is,   Id Name 0 1 Adam 1 2 Michael 2 3 David 3 4 Jack 4 5 PeterOutput −After, sorting the elements in descending order as,   Id Name 4 5 Peter 1 2 Michael 3 4 Jack 2 3 David 0 1 AdamSolutionTo solve this, we will follow the below approaches.Define a DataFrameApply DataFrame sort_values method based on Name column and add argument ascending=False to show the data in descending order. It is defined below, df.sort_values(by='Name', ascending=False)ExampleLet us see the following implementation to get a better understanding.import pandas as pd data = {'Id': [1, ... Read More

Advertisements