Found 26504 Articles for Server Side Programming

Which is the fastest implementation of Python

pawandeep
Updated on 11-Jun-2021 12:51:50

917 Views

Python has many active implementations. We will be addressing its different implementations and know which is the fastest implementation.Different implementations of Python −IronPython − This is the Python implementation which runs on .NET framework. This implementation is written in C#. It uses .net virtual machine for running. IronPython can use the python libraries and .net framework libraries.Jython − Jython is the implementation of Python which runs on the Java Platform. The jython makes use of the java classes and libraries. The jythoncode is compiled into java byte code and it is run on Java Virtual Machine.PyPy − This is the implementation of Python ... Read More

What is Python Unit Testing?

pawandeep
Updated on 11-Jun-2021 12:51:30

691 Views

What is unit testing?Unit testing is a type of software testing where each individual component of the system is tested. Unit testing is important practice for the developers. It ensures that every component of the software is functioning appropriately as expected. Unit testing is mainly performed by the developers during the coding phase of the software development.Unit testing makes it easy to fix the problems as the developers come to know which particular component of the system or software has the issues and the developers can fix that particular unit.Python Unit TestingThe python has an in-built package called unittest which is ... Read More

How to read JSON file in Python

pawandeep
Updated on 23-Aug-2023 03:50:38

78K+ Views

What is a JSON file?JSON stands for JavaScript Object Notation. It is commonly used for transmitting data in web applications (such as sending data from server to client to display on the web pages).Sample JSON FileExample 1: {    "fruit": "Apple",    "size": "Large",    "color": "Red" }Example 2: {    'name': 'Karan',    'languages': ['English', 'French'] }The json file will have .json extensionRead JSON file in PythonPython has an in-built package called json which can be used to work with JSON data and to read JSON files. The json module has many functions among which load() and loads() are ... Read More

What is Insertion sort in Python?

pawandeep
Updated on 11-Jun-2021 12:50:08

6K+ Views

Insertion sort is the simple method of sorting an array. In this technique, the array is virtually split into the sorted and unsorted part. An element from unsorted part is picked and is placed at correct position in the sorted part.The array elements are traversed from 1 to n.If the array element at position i is greater than its predecessor, it does not need to be moved.If the array element at position i is less than its predecessor, it needs to be shifted towards left until we find a predecessor smaller than it or if we reach at the leftmost ... Read More

How to create a DataFrame in Python?

pawandeep
Updated on 25-Aug-2023 01:13:12

34K+ Views

Dataframe is a 2D data structure. Dataframe is used to represent data in tabular format in rows and columns. It is like a spreadsheet or a sql table. Dataframe is a Pandas object.To create a dataframe, we need to import pandas. Dataframe can be created using dataframe() function. The dataframe() takes one or two parameters. The first one is the data which is to be filled in the dataframe table. The data can be in form of list of lists or dictionary of lists. In case of list of lists data, the second parameter is the columns name.Create dataframe from ... Read More

How to connect Database in Python?

pawandeep
Updated on 11-Jun-2021 12:49:17

4K+ Views

Most of the applications need to be integrated or connected with a database for performing certain relevant operations. The majority of projects require database connectivity to store certain data about the users. MySQL Database can be integrated with the Python applications.To connect MySQL database, we need to have it installed on our system. We need MySQL Connector to establish connection with the database. We can install MySql Connector using the following command.python –m pip install mysql-connector-pythonThis will install the MySQL Connector which is used to connect the python project or application to a database.Create a connectionFirst of all, it is ... Read More

How to clear Python shell?

pawandeep
Updated on 31-Oct-2023 03:26:00

26K+ Views

Python provides a python shell which is used to execute a single Python command and display the result. It is also called REPL. REPL stands for Read, Evaluate, Print and Loop. The command is read, then evaluated, afterwards the result is printed and looped back to read the next command.Sometimes after executing so many commands and getting haphazard output or having executed some unnecessary commands, we may need to clear the python shell. If the shell is not cleared, we will need to scroll the screen too many times which is inefficient. Thus, it is required to clear the python ... Read More

How to read a text file in Python?

Pawandeep Kaur
Updated on 10-Jun-2021 13:39:07

36K+ Views

A text file is the file containing simple text. Python provides inbuilt functions to read, create and write text files. We will discuss how to read a text file in Python.There are three ways to read a text file in Python −read() − This method reads the entire file and returns a single string containing all the contents of the file .readline() − This method reads a single line from the file and returns it as string.readlines() − This method reads all the lines and return them as the list of strings.Read a file in PythonLet there be a text file named ... Read More

How to plot a graph in Python?

Pawandeep Kaur
Updated on 23-Aug-2023 21:59:14

64K+ Views

Graphs in Python can be plotted by using the Matplotlib library. Matplotlib library is mainly used for graph plotting.You need to install matplotlib before using it to plot graphs. Matplotlib is used to draw a simple line, bargraphs, histograms and piecharts. Inbuilt functions are available to draw all types of graphs in the matplotlib library.Plot a line in a graphWe will plot a simple line in a graph using matplotlib. The following steps are involved in plotting a line.Import matplotlibSpecify the x-coordinates and y-coordinates of the linePlot the specified points using specific function using .plot() functionName the x-axis and y-axis ... Read More

Explain and show the use of UNION in MySQL using Python?

Pawandeep Kaur
Updated on 10-Jun-2021 13:37:11

975 Views

The UNION statement is used to combine the results of the two SELECT queries without repeating the duplicate values. If both the SELECT queries return same row, it is listed only once.To perform the UNION on two select statements, The number of columns returned must be sameThe datatypes of the columns must be sameThe columns must be returned in same order by both the select statements.SyntaxSELECT column_name FROM table1 UNION SELECT column_name FROM table2Steps to perform union of two select queries using MySQL in pythonimport MySQL connectorimport MySQL connectorestablish connection with the connector using connect()create the cursor object using cursor() ... Read More

Advertisements