Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Mukul Latiyan
Page 6 of 37
How to convert CSV File to PDF File using Python?
In today's data-driven world, being able to convert CSV files to more presentable PDF format is a common requirement. Python provides powerful libraries that make this conversion process straightforward and efficient. This tutorial demonstrates how to convert CSV files to PDF using Python by first converting the CSV to HTML format using pandas, then converting the HTML to PDF using pdfkit. Required Libraries and Setup Before starting, you'll need to install the required libraries and the wkhtmltopdf utility ? pip install pandas pdfkit You also need to install wkhtmltopdf from: https://wkhtmltopdf.org/downloads.html Sample ...
Read MoreHow to convert CSV columns to text in Python?
CSV (Comma Separated Values) files are commonly used to store and exchange tabular data. However, there may be situations where you need to convert the data in CSV columns to text format, for example, to use it as input for natural language processing tasks or data analysis. Python provides several tools and libraries that can help with this task. In this tutorial, we will explore different methods for converting CSV columns to text in Python using the Pandas library. Approach Load the CSV file into a pandas DataFrame using the read_csv() function. Extract the desired column ...
Read MoreHow to convert categorical data to binary data in Python?
Categorical data, also known as nominal data, is a type of data that is divided into discrete categories or groups. These categories have no inherent order or numerical value, and they are usually represented by words, labels, or symbols. Categorical data is commonly used to describe characteristics or attributes of objects, people, or events, and it can be found in various fields such as social sciences, marketing, and medical research. In Python, categorical data can be represented using various data structures, such as lists, tuples, dictionaries, and arrays. The most commonly used data structure for categorical data in Python ...
Read MoreHow to convert a NumPy array to a dictionary in Python?
Converting a NumPy array to a dictionary in Python is useful when you need dictionary operations like key-based lookups or when working with APIs that require dictionary inputs. This tutorial demonstrates multiple approaches to perform this conversion. Understanding NumPy Arrays A NumPy array is a table of elements (typically numbers) of the same data type, indexed by a tuple of positive integers. The ndarray class provides efficient storage and operations for multi-dimensional data. Method 1: Converting Individual Elements to Dictionary This approach flattens the array and creates a dictionary where keys are indices and values are ...
Read MoreHow to add a new entry to the PATH variable in ZSH on Mac OS in Linux
The PATH variable in ZSH determines where the shell looks for executable commands. By default, macOS Catalina and later versions don't include a .zshrc file, so we need to create one to customize our shell environment. This file contains configuration settings and environment variables that are loaded every time a new ZSH session starts. Creating the .zshrc File To create the .zshrc file, follow these steps − Open Terminal Type touch ~/.zshrc to create the file Press Return You can open and edit the .zshrc file from any directory using − vi ...
Read MoreBest practices when running Node.js with port 80 (Ubuntu) in Linux
Running Node.js applications on port 80 is a common requirement for web servers, but it presents security challenges on Linux systems. Port 80 is a privileged port that requires root access to bind to, creating potential security vulnerabilities when applications run with elevated privileges. The Root Privilege Problem Most Linux distributions require root privileges to bind to ports below 1024, including port 80. The naive approach is to run the application with superuser privileges: sudo node server.js While this solves the immediate problem, it creates significant security risks. If an attacker compromises your Node.js ...
Read MoreConvert XLSX to CSV in Linux with Command Line in Linux
XLSX files are the standard format for modern Microsoft Excel spreadsheets, containing structured data organized in rows and columns. CSV (Comma-Separated Values) files are plain text files where data records are separated by commas, making them more portable and easier to process programmatically. Converting XLSX to CSV in Linux can be accomplished using several command-line tools. This guide covers the two most effective methods: ssconvert from Gnumeric and libreoffice headless mode. Method 1: Using Gnumeric ssconvert The Gnumeric spreadsheet application includes a powerful command-line utility called ssconvert that handles various spreadsheet format conversions. Installation First, ...
Read MoreCrontab day of the week syntax on Linux
A crontab is a configuration file that contains a list of commands scheduled to run at specific times. It uses the cron daemon, a time-based job scheduler in Unix-like operating systems, to execute these commands automatically. Understanding Crontab Syntax To create or edit a crontab job, use the following command: crontab -e This opens the crontab editor where you can add scheduled jobs. Each crontab entry follows a specific format with five time fields followed by the command to execute: * * * * * command_to_execute Crontab Time Fields ...
Read MoreFastest way to tell if two files have the same contents in Unix/Linux
Let's say that we have two files inside a directory called dir1, and at first both these files are different. Different in the sense that the text they contain isn't the same. The files in the folder − immukul@192 dir1 % ls -ltr total 16 -rw-r--r-- 1 immukul staff 7 Jul 7 10:37 2.txt -rw-r--r-- 1 immukul staff 8 Jul 8 19:05 3.txt The contents inside the first file (2.txt) looks something like this − immukul@192 dir1 % cat 2.txt orange The contents inside the second file (3.txt) looks something like ...
Read MoreLinux – How to find the files existing in one directory but not in the other directory?
Let's consider a case where we have two directories, say d1 and d2, and both these directories contain some files, which may be the same or different. Now we want to list out the names of those files that are present in one of these directories (say d1) and not present in the other directory (say d2). In order to do that we must be familiar with either the diff command or the comm command, as both these commands can be used to solve the above problem. Using the diff Command Let's first explore the diff command, ...
Read More