pythoncodelab.com

truncate decimal number

How to truncate decimals in Python

When we are working with numbers in Python, we sometimes come across situations where we get numbers like 34.00001, 10000.2358, etc. But in certain situations, these decimal points don’t add value to our calculation and we want to round or truncate the decimals. In this blog, we will see several techniques for truncating decimals using

How to truncate decimals in Python Read More »

Python basic MCQs

Basic Python MCQs covering functions, exception handling, lists, tuples, and dictionaries.

The following blog contains 60 MCQs on Python basic. It includes topics like functions, try and exception, list, tuple and dictionary. This MCQ tests your understanding of the basics in Python. Python Functions MCQ A Python function is a block of reusable code that is used to perform a specific task. These Python functions help

Basic Python MCQs covering functions, exception handling, lists, tuples, and dictionaries. Read More »

error cuda kernal image

Fixed runtimeerror: cuda error: no kernel image is available for execution on the device

Summary The blog has been written by a machine learning practitioner. He has practical experience in solving CUDA and GPU issues of compatibility in production environments using PyTorch and TensorFlow. The solution shared here is based on troubleshooting of NVIDIA GPUs across multiple CUDA versions, driver configurations, and compute architectures The reason for getting RuntimeError:

Fixed runtimeerror: cuda error: no kernel image is available for execution on the device Read More »

Pandas series valueerror

Understanding the ValueError: can only compare identically-labeled series objects in Pandas

The error “ValueError: can only compare identically-labeled series objects” comes in Pandas and specifically when we are dealing with series. This error is quite frustrating when we are new to pandas and performing data analysis. Understanding ValueError: can only compare identically-labeled series objects with code examples. We get “ValueError: Can only compare identically-labeled Series objects”

Understanding the ValueError: can only compare identically-labeled series objects in Pandas Read More »

CUDA Error

Fixing the RuntimeError: cuda error: cublas_status_not_initialized in PyTorch

When we are working with GPU accelerated frameworks like PyTorch we tend to face errors related to CUDA which can be a frustrating experience. One such error is RuntimeError: cuda error: cublas_status_not_initialized when calling cublascreate(handle). Knowing the exact cause of error is quite difficult but we can narrow it down to places where we can

Fixing the RuntimeError: cuda error: cublas_status_not_initialized in PyTorch Read More »

notimplementederror loading a dataset

Solving notimplementederror: loading a dataset cached in a localfilesystem is not supported.

The Hugging Face ‘datasets’ library has changed the way data scientists and machine learning developers access and manage datasets. One of the common issues that users face is the `NotImplementedError: loading a dataset cached in a LocalFileSystem is not supported`. This kind of error can really be frustrating when we are in the middle of

Solving notimplementederror: loading a dataset cached in a localfilesystem is not supported. Read More »

fatal_error_python_image

Solving Fatal Python Error: init_import_size: Failed to Import the Site Module Error

Python is used in various fields from web development to data science. As it is also technology, Python can sometimes encounter errors that can be frustrating for developers. One of these errors is the Fatal Error: init_import_size: Failed to import the site module.” In this blog post, we will explore what causes this error and

Solving Fatal Python Error: init_import_size: Failed to Import the Site Module Error Read More »