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 Jaisshree
95 articles
Fromisoformat() Function of Datetime.date Class in Python
The datetime.date class in Python provides a convenient way to represent and manipulate dates. The fromisoformat() method allows you to create a date object from a string in ISO 8601 format ("YYYY-MM-DD"). This method is particularly useful when parsing dates from log files, APIs, or any data source that provides dates in the standard ISO format. Syntax datetime.date.fromisoformat(date_string) Parameters: date_string − A string representing a date in ISO format "YYYY-MM-DD" Return Value: Returns a datetime.date object representing the parsed date. Example 1: Creating a Date Object from ISO String ...
Read MoreFinding the Number of Weekdays of a Given Month in NumPy
NumPy is a powerful Python library for numerical computing and data analysis. When working with date calculations, you often need to count weekdays (business days) within a specific month, excluding weekends and holidays. You can install NumPy using pip ? pip install numpy NumPy's busday_count() function calculates the number of business days (Monday to Friday) between two specific dates. Syntax numpy.busday_count(startdate, enddate, weekmask='1111100', holidays=None) Parameters startdate − Start date (inclusive) in "YYYY-MM-DD" format enddate − End date (exclusive) in "YYYY-MM-DD" format weekmask − Optional string defining valid weekdays ...
Read MoreFind the size of numpy Array
NumPy arrays are fundamental data structures for scientific computing in Python. When working with large datasets, it's crucial to understand how much memory your arrays consume. NumPy provides several methods to determine both the number of elements and memory usage of arrays. Types of NumPy Arrays NumPy supports two main types of arrays: 1D Arrays − Single dimensional arrays storing elements linearly Multi-dimensional Arrays − Arrays with nested structure (2D, 3D, etc.) Understanding Array Size vs Memory Size There are two important measurements for NumPy arrays: Array size − Total number ...
Read MoreFind the path to the given file in Python
Python users frequently work with files, particularly when reading, writing, or modifying data. However, finding a file's path is essential before performing any file operations. A file path refers to the location or directory where the file is stored in the system. Python provides several methods to find file paths ? Pathlib Module − Modern, object-oriented approach OS Module − Traditional method using os.path.abspath() os.path.join() method − Combines path components os.getcwd() method − Gets current working directory Using the Pathlib Module The pathlib module provides a modern, object-oriented approach to handle file paths. The ...
Read MoreFinding how much memory is being used by an object in Python
Memory management is crucial in Python programming. To measure how much memory an object consumes, Python provides several tools including the built-in sys.getsizeof() function and asizeof() from the pympler package. Understanding memory usage helps optimize your programs and prevent memory-related issues. Using sys.getsizeof() Function The sys.getsizeof() function returns the size of an object in bytes. It measures only the direct memory consumption of the object itself, not including referenced objects. Syntax sys.getsizeof(object) The function accepts any Python object and returns its size in bytes. Example import sys # Different ...
Read MoreFillna in Multiple Columns in Place in Python Pandas
Python's Pandas library provides powerful tools for handling missing data in DataFrames. The fillna() method is specifically designed to fill NaN (Not a Number) or null values with specified replacement values or strategies. Syntax DataFrame.fillna(value=None, method=None, axis=None, inplace=False, limit=None, downcast=None) Key Parameters value − Scalar value, dictionary, Series, or DataFrame to use for filling inplace − If True, modifies the original DataFrame instead of returning a copy method − Method to use for filling ('ffill', 'bfill', etc.) ...
Read MoreFilling area chart using plotly in Python
Plotly is a powerful Python library for creating interactive visualizations. It supports various chart types including line plots, scatter plots, area charts, bar charts, histograms, and more. Area charts are particularly useful for showing trends over time and comparing proportions between different categories. What is a Filled Area Chart? A filled area chart displays quantitative data graphically with the area below the line filled with color. It's effective for showing trends over time and comparing multiple data series. The px.area() function creates these charts with automatic color coordination for different categories. Built-in Datasets Plotly provides several ...
Read MoreFile Sharing App using Python
Bluetooth and WhatsApp are often used to send files from one device to another. Although both methods are convenient, having a simple QR Code to access files from other devices is remarkably useful. With Python, you can create this functionality in minutes. Using Python combined with networking concepts, we can build a simple file sharing application. This application provides both an IP address and QR Code − scan the code or type the IP address to access shared files from any device on the same network. Required Libraries This application uses several Python modules ? ...
Read MoreFidget Spinner Using Python
A fidget spinner is a simple toy that spins around a central bearing. We can create an animated fidget spinner simulation using Python's turtle graphics library. This project demonstrates graphics programming, animation loops, and user interaction concepts. Required Libraries The turtle library comes pre-installed with Python, so no additional installation is needed for most Python distributions ? # Turtle is included with standard Python installation import turtle The turtle library provides a simple interface for creating graphics and animations. It uses a virtual "turtle" that can move around the screen, drawing lines and shapes ...
Read MoreElement Methods in Selenium Python
Selenium is an open-source automation testing tool used with programming languages like Python, Java, JavaScript, and Perl to test web applications. It provides various element methods to interact with web page components programmatically. Essential Element Methods 1. send_keys() Used for entering text into input fields, text areas, and form elements. Also supports modifier keys like Ctrl, Alt, and Shift. Return Type: None 2. is_selected() Checks if an element like checkbox, radio button, or option is selected. Return Type: Boolean (True or False) 3. is_displayed() Verifies if an element is visible on the web page. Return Type: ...
Read More