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 4 of 37
How to Convert Scrapy items to JSON?
Web scraping is the process of extracting data from websites. Scrapy is a popular Python-based web scraping framework that provides a robust and efficient way to build web crawlers and extract structured data from websites. One of Scrapy's key features is its ability to parse and store data using custom Item classes. These classes define the structure of extracted data with fields corresponding to specific information. Once data is extracted and populated into Item instances, you often need to export it to various formats for analysis or storage. JSON (JavaScript Object Notation) is a lightweight, human-readable data format ...
Read MoreCleaning Data with Dropna in Pyspark
Data cleaning is a crucial step in any data analysis or data science project to ensure accuracy and reliability. PySpark's dropna() function provides powerful capabilities for removing rows containing missing or null values from DataFrames, making it essential for big data processing. The dropna() function allows you to specify conditions for removing rows based on missing values, with flexible parameters for different cleaning strategies. Syntax df.dropna(how="any", thresh=None, subset=None) Parameters how − Determines when to drop rows. Use "any" to drop rows with any null values, or "all" to drop only rows where ...
Read MoreChange Value in Excel Using Python
In this article, we will learn different approaches to change values in Excel files using Python. We'll explore two main libraries: openpyxl for modern Excel formats and xlwt/xlrd/xlutils for legacy formats. Using Openpyxl Openpyxl is a Python library designed for working with Excel spreadsheets. It supports modern Excel file formats including: XLSX (Microsoft Excel Open XML Spreadsheet) XLSM (Microsoft Excel Open XML Macro−Enabled Spreadsheet) XLTM (Microsoft Excel Open XML Macro−Enabled Template) XLTX (Microsoft Excel Open XML Template) Key Features Reading and Writing: Create, modify, and save Excel files Data Manipulation: Sort, filter, ...
Read MoreCluster Sampling in Pandas
In this article, we will learn how we can perform cluster sampling in Pandas. But before we deep dive into that, let's explore what sampling is in Pandas and how it helps us analyze data efficiently. Sampling in Pandas In Pandas, sampling refers to the process of selecting a subset of rows or columns from a DataFrame or Series object. Sampling can be useful in many data analysis tasks, such as data exploration, testing, and validation. Pandas provides several methods for sampling data, including: DataFrame.sample(): This method returns a random sample of rows from a ...
Read MoreClear LRU Cache in Python
In this article, we will learn how to clear an LRU cache implemented in Python. LRU Cache (Least Recently Used Cache) is a data structure that improves application performance by storing frequently-used data and removing the least recently used items when the cache becomes full. The LRU Cache is particularly useful in applications with high-cost data retrieval operations, such as disk I/O or network access. By caching frequently-used data in memory, applications can significantly reduce expensive operations and improve performance. Understanding LRU Cache in Python Python's functools module provides the @lru_cache decorator to implement LRU caching. This ...
Read MoreCheck if a String is Present in a Pdf File in Python
In today's digital world, PDF files have become an essential medium for storing and sharing information. Python provides several libraries that allow us to interact with PDF files and extract information from them. One common task is to search for a particular string within a PDF file. However, the simple text-based approach shown below has significant limitations. Opening a PDF file as plain text will not work properly because PDFs contain binary data, formatting, and metadata. For real PDF processing, you should use specialized libraries like PyPDF2 or pdfplumber. Basic Text Search Approach (Limited) This approach treats ...
Read MoreChange the View of Tensor in PyTorch
PyTorch tensors support the view() method to reshape tensor dimensions without copying data. This is essential for deep learning operations where you need to transform tensor shapes for different layers. What is tensor.view()? The view() method returns a new tensor with the same data but different shape. It's memory-efficient because it creates a new view of the existing data rather than copying it. Syntax tensor.view(*shape) tensor.view(rows, columns) The total number of elements must remain constant. For a tensor with 12 elements, valid shapes include (12, ), (3, 4), (2, 6), etc. Basic ...
Read MoreHow to Create a Pivot Table in Python using Pandas?
A pivot table is a powerful data analysis tool that allows you to summarize and aggregate data based on different dimensions. In Python, you can create pivot tables using the pandas library, which provides flexible and efficient tools for data manipulation and analysis. To create a pivot table in pandas, you first need to have a dataset in a pandas DataFrame. You can load data into a DataFrame from various sources such as CSV files, Excel spreadsheets, SQL databases, and more. Syntax Once you have your data in a DataFrame, you can use the pandas pivot_table() function ...
Read MoreHow to Create a Pie Chart in Seaborn?
A pie chart is a circular chart divided into slices to represent proportions of different categories in a dataset. While Seaborn doesn't have a direct pie chart function, we can combine Seaborn's color palettes with Matplotlib's pie() function to create visually appealing pie charts. Seaborn is a Python data visualization library built on top of Matplotlib that provides high-level statistical graphics with beautiful default themes and color palettes. Basic Pie Chart with Seaborn Colors Let's create a simple pie chart using Matplotlib's pie() function with Seaborn's color palette − import matplotlib.pyplot as plt import seaborn ...
Read MoreHow to create a meeting with the zoom API in Python?
Zoom is a video conferencing platform that provides an API for developers to programmatically interact with its features. Python offers a simple way to create Zoom meetings through API calls using the requests library and JWT authentication. This guide demonstrates how to create a Zoom meeting using Python and the Zoom API. You can automate meeting creation and integrate it with other applications or workflows. Prerequisites and Setup To use the Zoom API, you must first create a Zoom app by following these steps: Go to https://marketplace.zoom.us/ and sign in to your Zoom account. Click ...
Read More