ItsMyCode
  • How To
  • Python
    • Basics
    • Advanced
    • Built-In Methods
    • Dictionary Methods
    • String Methods
    • List Methods
    • Date and Time
    • Files and Folders
    • Matplotlib
    • Seaborn
    • NumPy
    • Pandas
    • SciPy
    • Errors and Exception
    • Django
  • R
  • Git
  • Powershell
  • Javascript
  • C#
    • Sitecore
  • Node.js
ItsMyCode

Coding Simplified

  • How To
  • Python
    • Basics
    • Advanced
    • Built-In Methods
    • Dictionary Methods
    • String Methods
    • List Methods
    • Date and Time
    • Files and Folders
    • Matplotlib
    • Seaborn
    • NumPy
    • Pandas
    • SciPy
    • Errors and Exception
    • Django
  • R
  • Git
  • Powershell
  • Javascript
  • C#
    • Sitecore
  • Node.js
541
98
0

Home » Python

Browsing Category

Python

221 posts

Python is a widely used, high-level programming language. Python tutorial and articles will help you learn Python with a help of high quality examples.

Subcategories
  • Advanced
  • Basics
  • Built-In Methods
  • Date and Time
  • Dictionary Methods
  • Django
  • Errors and Exception
  • Files and Folders
  • List Methods
  • NumPy
  • Pandas
  • SciPy
  • Seaborn
  • String Methods
Numpy.median() Method
  • Python
  • NumPy
  • 3 minute read

numpy.median() Function

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
The NumPy library has a numpy.median() function is used to compute the median of an array in sorted order on a specified axis and returns the median of the array…
View Post
Check The Numpy Version
  • Python
  • NumPy
  • 2 minute read

How to Check the NumPy Version

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
There are multiple ways to check the NumPy version; however, the easiest and PEP8 standard practice is to import numpy and use the numpy.__version__ attribute to get the exact version…
View Post
Numpy.ndarray.flatten() Function
  • Python
  • NumPy
  • 4 minute read

numpy.ndarray.flatten() function

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
The numpy.ndarray.flatten() function in the NumPy array library is used to flatten an array of elements in different orders. The flattening of a NumPy n-dimensional array in python is a procedure to return a copy of…
View Post
Numpy.mean() Function
  • Python
  • NumPy
  • 5 minute read

numpy.mean() Function

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
The numpy.mean() is a function in the NumPy library that is used to calculate the mean of an array of elements along with an axis. In NumPy array library or…
View Post
Numpy.average() Function
  • Python
  • NumPy
  • 4 minute read

numpy.average() Function

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
The numpy.average() function computes the weighted average of elements that are specified NumPy array along the specified axis. The average in linear algebra is the proportion of the sum of…
View Post
Numpy.repeat() Function
  • Python
  • NumPy
  • 3 minute read

numpy.repeat() Function

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
The numpy.repeat() function takes the repetitions (int) as an input argument, repeats the elements of an array, and returns the repeated array as output. The repetitions can happen row and…
View Post
Numpy.transpose() Function
  • Python
  • NumPy
  • 2 minute read

numpy.transpose() Function

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
The numpy.transpose() function takes the array as an input, reverses its dimension, and returns the transposed array. In simple terms, the NumPy transpose swaps from rows to columns and columns…
View Post
Inconsistent Use Of Tabs And Spaces In Indentation
  • Python
  • Errors and Exception
  • 2 minute read

TabError: inconsistent use of tabs and spaces in indentation

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
The TabError: inconsistent use of tabs and spaces in indentation occurs if you indent the code using a combination of whitespaces and tabs in the same code block. What is inconsistent use…
View Post
Check If A List Is Empty In Python
  • Python
  • Basics
  • 3 minute read

Check if a list is empty in Python

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
There are multiple ways to check if a list is empty in Python, and the most efficient way is by using the Pep-8 style, called “Truth Value Testing“. How to…
View Post
Numpy.shape() Function
  • Python
  • NumPy
  • 2 minute read

numpy.shape() Function

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
The numpy.shape() function will return the shape of the given array in tuple format. The shape of the array is the elements in each dimension. Dimension is the count of…
View Post
Python Type()
  • Python
  • Built-In Methods
  • 2 minute read

Python type()

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
Python type() is a built-in function that returns the type of the object or returns a new type object when all the three arguments are passed to the type() method.…
View Post
Python Dictionary Get()
  • Python
  • Dictionary Methods
  • 2 minute read

Python Dictionary get()

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
Python Dictionary get() is a built-in function that returns the value for a specified key if present in the dictionary. If the key is not present, it returns None by default. …
View Post
Runtimewarning: Invalid Value Encountered In Double_Scalars
  • Python
  • Errors and Exception
  • 2 minute read

[Solved] RuntimeWarning: invalid value encountered in double_scalars

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
The RuntimeWarning: invalid value encountered in double_scalars occurs when you perform a complex mathematical operation using NumPy that involves extremely small or very large numbers and also if we pass an invalid…
View Post
Attributeerror: Module 'Matplotlib' Has No Attribute 'Plot'
  • Python
  • Errors and Exception
  • 2 minute read

AttributeError: module ‘matplotlib’ has no attribute ‘plot’

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
The AttributeError: module ‘matplotlib’ has no attribute ‘plot’ mainly occurs if you have not imported the matplotlib properly in your code, or if you have not correctly installed the matplotlib…
View Post
Typeerror: 'Str' Object Does Not Support Item Assignment
  • Python
  • Errors and Exception
  • 3 minute read

TypeError: ‘str’ object does not support item assignment

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • November 8, 2022
In Python, strings are immutable, which means we cannot change certain characters or the text of a string using the assignment operator. If you try to change the string value,…
View Post
Valueerror: I/O Operation On Closed File
  • Python
  • Errors and Exception
  • 4 minute read

[Solved] ValueError: I/O operation on closed file

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The i/o operations in Python are performed when the file is in an open state. So if we are trying to read or write into a file that is already…
View Post
Typeerror: __Init__() Missing 2 Required Positional Arguments
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] TypeError: __init__() missing 2 required positional arguments

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
If we are instantiating the class that accepts 2 required positional parameters and if we do not pass those 2 required arguments Python interpreter will throw TypeError: __init__() missing 2 required…
View Post
Typeerror: Missing 2 Required Positional Arguments
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] TypeError: missing 2 required positional arguments

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
If we have a function that accepts 2 arguments, and while calling the method, if we do not pass those 2 required arguments Python interpreter will throw TypeError: missing 2 required…
View Post
Attributeerror: Module 'Time' Has No Attribute 'Clock'
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] AttributeError: module ‘time’ has no attribute ‘clock’

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The time.clock() method has been removed in Python 3.8 onwards. Hence if you are using the clock() method in Python 3.8 or above, you will get AttributeError: module ‘time’ has no…
View Post
Attributeerror: 'Tuple' Object Has No Attribute 'Get'
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] AttributeError: ‘tuple’ object has no attribute ‘get’

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The AttributeError: ‘tuple’ object has no attribute ‘get’ mainly occurs when you try to call the get() method on the tuple value. The attribute get() method is present in the dictionary and must be called on…
View Post
Attributeerror: 'Nonetype' Object Has No Attribute 'Get'
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] AttributeError: ‘NoneType’ object has no attribute ‘get’

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The AttributeError: ‘NoneType’ object has no attribute ‘get’ mainly occurs when you try to call the get() method on the None value. The attribute get() method is present in the dictionary and must be called on…
View Post
Attributeerror: 'Float' Object Has No Attribute 'Get'
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] AttributeError: ‘float’ object has no attribute ‘get’

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The AttributeError: ‘float’ object has no attribute ‘get’ mainly occurs when you try to call the get() method on the float data type. The attribute get() method is present in the dictionary and must be called…
View Post
Attributeerror: 'List' Object Has No Attribute 'Get'
  • Python
  • Errors and Exception
  • 4 minute read

[Solved] AttributeError: ‘list’ object has no attribute ‘get’

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The AttributeError: ‘list’ object has no attribute ‘get’ mainly occurs when you try to call the get() method on the list data type. The attribute get() method is present in the dictionary and must be called…
View Post
Attributeerror: 'Str' Object Has No Attribute 'Get'
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] AttributeError: ‘str’ object has no attribute ‘get’

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The AttributeError: ‘str’ object has no attribute ‘get’ mainly occurs when you try to call the get() method on the string data type. The attribute get() method is present in the dictionary and must be called…
View Post
Attributeerror: 'Int' Object Has No Attribute 'Get'
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] AttributeError: ‘int’ object has no attribute ‘get’

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The AttributeError: ‘int’ object has no attribute ‘get’ mainly occurs when you try to call the get() method on the integer type. The attribute get() method is present in the dictionary and must be called on…
View Post
Attributeerror: Module 'Datetime' Has No Attribute 'Utcnow'
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] AttributeError: module ‘datetime’ has no attribute ‘utcnow’

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The AttributeError: module ‘datetime’ has no attribute ‘utcnow’ occurs if you have imported the datetime module and directly if we are using the datetime.utcnow() method on the datetime module.  The…
View Post
Typeerror: Cannot Unpack Non-Iterable Nonetype Object
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] TypeError: cannot unpack non-iterable NoneType object

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • September 20, 2022
The TypeError: cannot unpack non-iterable NoneType object occurs when we try to unpack the values from the method that does not return any value or if we try to assign the None…
View Post
Attributeerror: 'Module' Object Has No Attribute 'Strptime'
  • Python
  • Errors and Exception
  • 2 minute read

[Solved] AttributeError: ‘module’ object has no attribute ‘strptime’

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The AttributeError: ‘module’ object has no attribute ‘strptime’ occurs if you have imported the datetime module and directly if we are using the datetime.strptime() method on the datetime module.  The…
View Post
How To Get Column Names In Pandas Dataframe
  • Python
  • Pandas
  • 6 minute read

How to get column names in Pandas Dataframe

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
Pandas DataFrame is Two-dimensional, size-mutable, potentially heterogeneous tabular data. Pandas DataFrame consists of rows and columns to store the data. Each column will have its own header name that can be…
View Post
Convert Datetime To Unix Timestamp In Python
  • Python
  • 2 minute read

Convert DateTime to Unix timestamp in Python

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • April 23, 2022
This tutorial will look at how to convert DateTime to Unix timestamp in Python and String Date to timestamp with examples. What is Unix Timestamp? Unix was initially developed between…
View Post
Python List Pop()
  • Python
  • List Methods
  • 2 minute read

Python List pop()

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
Python List pop() is a built-in function that removes the item at the specified index from the list and returns the removed item. If the index is not passed, the last…
View Post
Deprecationwarning: Find_Element_By_* Commands Are Deprecated. Please Use Find_Element() Instead
  • Python
  • Errors and Exception
  • 2 minute read

[Solved] Deprecationwarning: find_element_by_* commands are deprecated. please use find_element() instead

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
If you use Selenium 4.0.0 or above and try to find the elements on the page using the find_element_by_*() method, you will get an error saying DeprecationWarning: find_element_by_* commands are deprecated. Please use…
View Post
Solving Environment: Failed With Initial Frozen Solve. Retrying With Flexible Solve
  • Python
  • Errors and Exception
  • 2 minute read

Solving environment: failed with initial frozen solve. retrying with flexible solve

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The Solving environment: failed with initial frozen solve. retrying with flexible solve occurs if you try to download any package that already exists and it breaks the anaconda environment. In this tutorial,…
View Post
How To Enable Cors On Django Rest Framework
  • Django
  • Python
  • 2 minute read

How to enable CORS on Django REST Framework?

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • March 31, 2022
 If we are building an API layer using the Django REST framework and accessing these APIs in the front-end application we need to enable the CORS on Django Rest Framework…
View Post
Syntaxerror: (Unicode Error) ‘Unicodeescape’ Codec Can’t Decode Bytes In Position 2-3: Truncated \Uxxxxxxxx Escape
  • Python
  • Errors and Exception
  • 2 minute read

SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape occurs if you are trying to access a file path with a regular string. In…
View Post
Syntaxerror: Positional Argument Follows Keyword Argument
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] SyntaxError: Positional argument follows keyword argument

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
If you provide the keyword argument first followed by a positional argument, the Python interpreter will raise SyntaxError: positional argument follows keyword argument. In this tutorial, we will learn what SyntaxError: positional…
View Post
Attributeerror: 'Numpy.ndarray' Object Has No Attribute 'Append'
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] AttributeError: ‘numpy.ndarray’ object has no attribute ‘append’

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
If you use the regular Python list append() method to add an element to the end of NumPy array, you will encounter AttributeError: ‘numpy.ndarray’ object has no attribute ‘append’. In this…
View Post
Valueerror: Cannot Convert Float Nan To Integer
  • Python
  • Errors and Exception
  • 5 minute read

[Solved] ValueError: cannot convert float NaN to integer

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The ValueError: cannot convert float NaN to integer occurs when we attempt to convert the pandas DataFrame column from float to an integer where the column contains NaN value. In…
View Post
Runtimewarning: Invalid Value Encountered In True_Divide
  • Python
  • Errors and Exception
  • 2 minute read

[Solved] RuntimeWarning: invalid value encountered in true_divide

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
Suppose you attempt to divide the NumPy arrays elements using the divide() method with invalid values such as 0/0, NaN Infinity, zero, etc. you will encounter a RuntimeWarning: invalid value encountered…
View Post
Fatal Error: Ineffective Mark-Compacts Near Heap Limit Allocation Failed - Javascript Heap Out Of Memory
  • Python
  • Errors and Exception
  • Javascript
  • Node.js
  • 2 minute read

[Solved] fatal error: ineffective mark-compacts near heap limit allocation failed – javascript heap out of memory

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The fatal error: ineffective mark-compacts near heap limit allocation failed – javascript heap out of memory occurs if there is any memory leak or the application consumes a lot of…
View Post
Convert Letters To Numbers In Python
  • Python
  • Basics
  • 2 minute read

Convert Letters to Numbers in Python

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
Using the ord() method, we can convert letters to numbers in Python. The ord() method returns an integer representing the Unicode character. In this tutorial, we will look at converting…
View Post
Attributeerror: 'Str' Object Has No Attribute 'Decode'
  • Python
  • Errors and Exception
  • 2 minute read

[Solved] AttributeError: ‘str’ object has no attribute ‘decode’

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
In Python 3, all the strings are in Unicode format by default. If you try to decode the Unicode string in Python 3, you will encounter an AttributeError: ‘str’ object…
View Post
Python List Clear()
  • Python
  • List Methods
  • 1 minute read

Python List clear()

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
Python List clear() is a built-in function that removes all the items and makes a list empty. In this tutorial, we will learn about the Python list clear() method with the help of…
View Post
Python List Count()
  • Python
  • List Methods
  • 1 minute read

Python List count()

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
Python List count() is a built-in function that returns the number of times the specified element occurs in the list. In this tutorial, we will learn about the Python list count() method with…
View Post
Defaulting To User Installation Because Normal Site-Packages Is Not Writeable
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] Defaulting to user installation because normal site-packages is not writeable

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
If you have multiple versions of Python and try to install the packages using the pip3 install <package> command Python will throw an error defaulting to user installation because normal site-packages…
View Post
Importerror: Libgl.so.1: Cannot Open Shared Object File: No Such File Or Directory
  • Python
  • Errors and Exception
  • 3 minute read

[Solved] Importerror: libgl.so.1: cannot open shared object file: no such file or directory

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
If you are using cv2 or opencv-python and then building the application through docker you will get an importerror: libgl.so.1: cannot open shared object file: no such file or directory. In…
View Post
Python List Remove()
  • Python
  • List Methods
  • 2 minute read

Python List remove()

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
Python List remove() is a built-in function that removes the first occurrence element from the list. In this tutorial, we will learn about the Python list remove() method with the help of examples.…
View Post
Python List Insert()
  • Python
  • List Methods
  • 2 minute read

Python List insert()

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
Python List insert() is a built-in function that inserts the given element at a specified index.  In this tutorial, we will learn about the Python list insert() method with the help of examples.…
View Post
Python List Extend()
  • Python
  • List Methods
  • 2 minute read

Python List extend()

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The extend() method in Python adds the iterable elements (list, tuple, string etc.) to the end of the list. The length of the list is increased by the number of elements present…
View Post
Python List Append()
  • Python
  • List Methods
  • 1 minute read

Python List append()

  • Avatar Of Srinivas RamakrishnaSrinivas Ramakrishna
  • August 20, 2022
The append() method in Python adds an element to the end of the list. After appending the new element, the size of the list increases by one. In this tutorial,…
View Post

Posts navigation

1 2 … 5 Next
  • Metrics Converter
  • Sitemap
  • Privacy Policy
  • Cookie Policy
  • Contact Us
541
98
0
0
ItsMyCode
Copyright © 2022· All Rights Reserved