Convert PDF to CSV Using Python

Dev Prakash Sharma
Updated on 21-Apr-2021 07:33:41

17K+ Views

Python is well known for its huge library of packages. With the help of libraries, we will see how to convert a PDF to a CSV file. A CSV file is nothing but a collection of data, framed along with a set of rows and columns. There are various packages available in the Python library to convert PDF to CSV, but we will use the Tabula-py module. The major part of tabula-py is written in Java that first reads the PDF document and converts the Python DataFrame into a JSON object.In order to work with tabula-py, we must have Java ... Read More

Difference Between Hypertext and Hypermedia

AmitDiwan
Updated on 21-Apr-2021 07:33:28

6K+ Views

In this post, we will understand the difference between hypertext and hypermedia −HypertextIt refers to the system of managing the information related to the plain text.It involves only text.It becomes a part of the link.It is the part of hypermedia.It allows the user to traverse through text in a non-linear fashion.It allows users to move from one document to another in a single click.The user can click on the hypertext or the ‘goto’ links.It helps the user move to the next document.It also helps the user move from one page of a document to the other page.It doesn’t provide a ... Read More

Convert Images to PDFs Using Tkinter

Dev Prakash Sharma
Updated on 21-Apr-2021 07:33:13

624 Views

Python is a scripting language and thus, it helps in many ways to create file converters such as CSV to PDF, PDF to DOC, and vice-versa. With the help of certain libraries, we can also create an application that converts images into PDF. To create such an application, we use the img2pdf module in Python. It helps to parse the image binary and converts it into PDFs.We will follow these steps to create an application, First, make sure the system has img2pdf requirements already in place. Type pip install img2pdf on your terminal to install the package. Import img2pdf in ... Read More

Changing TTK Button Height in Python

Dev Prakash Sharma
Updated on 21-Apr-2021 07:32:52

3K+ Views

Ttk adds styles to the tkinter’s standard widget which can be configured through different properties and functions. We can change the height of the ttk button by using the grid(options) method. This method contains various attributes and properties with some different options. If we want to resize the ttk button, we can specify the value of internal padding such as ipadx and ipady.ExampleLet us understand it with an example, #Import tkinter library from tkinter import * from tkinter import ttk #Create an instance of tkinter frame or window win = Tk() #Set the geometry of tkinter frame win.geometry("750x250") #Create a ... Read More

Counting Number of Triangle Sides in an Array in JavaScript

AmitDiwan
Updated on 21-Apr-2021 07:06:11

225 Views

ProblemWe are required to write a JavaScript function that takes in an array of numbers, arr, as the first and the only argument.The task of our function is to count the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle.For example, if the input to the function is −const arr = [2, 2, 3, 4];Then the output should be −const output = 3;Output ExplanationValid combinations are:2, 3, 4 (using the first 2) 2, 3, 4 (using the second 2) 2, 2, 3ExampleFollowing is the code − Live Democonst arr ... Read More

Construct Array of Addition and Subtractions in JavaScript

AmitDiwan
Updated on 21-Apr-2021 07:01:55

146 Views

ProblemWe are required to write a JavaScript function that takes in an array of positive integers. Our function should map this array to an array of string integers.The array should contain the number we should add/subtract to the first element to achieve the corresponding element.For example[4, 3, 6, 2]should return −['+0', '-1', '+2', '-2']ExampleFollowing is the code − Live Democonst arr = [4, 3, 6, 2]; const buildRelative = (arr = []) => {    const res = [];    let num = '';    for(let i of arr){       if(i - arr[0] >= 0){         ... Read More

Change Second Half of String Number Digits to Zero Using JavaScript

AmitDiwan
Updated on 21-Apr-2021 07:01:02

196 Views

ProblemWe are required to write a JavaScript function that takes in a string number as the only argument.Our function should return the input number with the second half of digits changed to 0.In cases where the number has an odd number of digits, the middle digit onwards should be changed to 0.For example −938473 → 938000ExampleFollowing is the code − Live Democonst num = '938473'; const convertHalf = (num = '') => {    let i = num.toString();    let j = Math.floor(i.length / 2);    if (j * 2 === i.length) {       return parseInt(i.slice(0, j) + '0'.repeat(j)); ... Read More

Rotate Number to Form the Maximum Number Using JavaScript

AmitDiwan
Updated on 21-Apr-2021 07:00:42

172 Views

ProblemWe are required to write a JavaScript function that takes in a number n. Our function is required to return the maximum value by rearranging its digits.ExampleFollowing is the code −const num = 124; const rotateToMax = n => {    n = n       .toString()       .split('')       .map(el => +el);       n.sort((a, b) =>       return b - a;    });    return n    .join(''); }; console.log(rotateToMax(num));Output421

Sort Array and Find Sum of Differences Using JavaScript

AmitDiwan
Updated on 21-Apr-2021 07:00:27

361 Views

ProblemWe are required to write a JavaScript function that takes in an array of integers. Our function should sum the differences between consecutive pairs in the array in descending order.For example − If the array is −[6, 2, 15]Then the output should be −(15 - 6) + (6 - 2) = 13ExampleFollowing is the code − Live Democonst arr = [6, 2, 15]; const sumDifference = (arr = []) => {    const descArr = arr.sort((a, b) => b - a);    if (descArr.length

Check if Digit is Divisible by Previous Digit in JavaScript

AmitDiwan
Updated on 21-Apr-2021 07:00:06

218 Views

ProblemWe are required to write a JavaScript function that takes in a number and checks each digit if it is divisible by the digit on its left and returns an array of booleans.The booleans should always start with false because there is no digit before the first one.ExampleFollowing is the code − Live Democonst num = 73312; const divisibleByPrevious = (n = 1) => {    const str = n.toString();    const arr = [false];    for(let i = 1; i < str.length; ++i){       if(str[i] % str[i-1] === 0){          arr.push(true);       }else{          arr.push(false);       };    };    return arr; }; console.log(divisibleByPrevious(num));Output[ false, false, true, false, true ]

Advertisements