Polygon art logo of the programming language Python.

.T in NumPy: Meaning?

Here’s what the .T in NumPy means: .T is the returned transposed array with its axes permuted that is used in NumPy. It is the same as calling self.transpose(). When you use .T, you must have at least 2 arrays to work with. Having only 1 array is ineffective. This is a standard matrix transpose for a 2-D array. So if you want to learn all about the meaning of .T in NumPy in Python, then this article is for you. Let’s jump right into it! How Is .Transpose() Used In NumPy? When using .transpose() in NumPy, you’re essentially changing how you look at the array. Remember it needs to be a 2D array or bigger in order for transpose to work. Once called, transpose() will reverse or permute the array on its axes. Take a look at the image below. You have 2 stacks of blocks from 0-7 in front of you. Once you have called transpose(), the blocks have changed! No longer are they standing up but laying down on their side! You still have all 8 blocks(0-7) but their position has changed. It still reads 0-7 in order. Since multidimensional arrays in NumPy are fixed-sized, even transposed, the ndarray has the same number of items. All I did was change the group sizes. Instead of now having 4 groups of 2, I now have 2 groups of 4. If I didn’t have a 2D array, it would return the only ndarray available with no changes. The ndim or the number of array dimensions must be >= 2, else nothing happens. How Is a Transposed Array in NumPy Reshaped? (2 Methods) As you know with Python and so for NumPy, you can stack methods on top of one another to change the outcome of the output. In NumPy, you have 2 methods called .shape() and .reshape() respectively. Not to confuse the 2 of them together. You can use

Polygon art logo of the programming language Python.

Converting List to JSON Array in Python: How To?

This is how to convert a list to a JSON array in Python. To convert a list to a JSON array is called serialization. Learn how to serialize and deserialize a list with this in-depth article. Let’s get started! Learn How to Convert a List to JSON Array in Python You learn the structure of JSON objects and why they’re needed. Then you’ll learn how to convert lists to JSON arrays. This is called serialization.  Next we’ll convert JSON arrays to Python lists. This is called deserialization.  In addition, you’ll figure out how to combine two separate lists with field names and values into a single JSON object. So first things first: What’s JSON?  According to json.org, JSON is a lightweight data exchange format. It’s easy for humans to read and write.  Machines can easily interpret and generate JSON.  Don’t be intimidated by JavaScript in the acronym. JSON was born out of this language but turned out to be a great tool for sending data, for example in HTTP requests. It’s compact, lightweight, and easy to read.  So it is easy to transfer it via the network, it is easy to parse, and it is easy to read as simple text. What Is the Difference Between JSON and XML? If you’re familiar with XML, then JSON is very similar. There are also fields with names and values. Let’s compare JSON and XML for the same object. Here’s the JSON: Here’s the XML: XML looks less readable because of opening and closing tags. Yet, in general, both formats can be read without any extra processing. JSON Objects and JSON Arrays Let’s take a look at the JSON object. In this case, it’s an JSON array. It is enclosed in square brackets and can contain values of different types: Other JSON arrays JSON objects enclosed in curly braces Quoted string values Numeric values ​​(integer and float) Booleans ​​(true or false) Empty values

Polygon art logo of the programming language Python.

PIP vs. PIP3: Difference?

Here’s everything about PIP vs. PIP3 and how to use each. You’ll learn: So if you want to understand PIP and PIP3, then you are in the right place. Let’s get started! What Is the Difference Between PIP and PIP3? Sooner or later, anyone who starts learning Python faces the need to install additional modules.  However, this may not happen quickly, as the standard Python library is very extensive and contains modules for such as: Since version 2.7.9 for Python 2 and version 3.4 for Python 3, the standard distribution has included the PIP package manager.  By the way, PIP is a recursive acronym that stands for PIP installs packages. The difference between PIP and PIP3 in short and sweet: PIP is a soft link for a particular installer. Your system will use one of your Python versions depending on what exactly is first in the system PATH variable. When you run PIP3, you can be sure that the module will be installed in Python 3. But to understand truly the difference between PIP and PIP3 you need to understand the big picture and see PIP and PIP3 in action—let’s dive right in: When and How to Use PIP and PIP3? You can find the packages to download and install in the PyPI (Python Package Index) repository. Still, you can set up your repositories and install packages from them using the standard PIP tool.  Moreover, you can create your package, publish it on PyPI, and make it available for installation by all Python users. Typically, in manuals and instructions, package installation is written as: For example: However, you may also see other options, such as pip3 install instead of pip install. So how do you correctly install packages on your system and what is the difference between PIP and PIP3? When you type pip in the console, the system looks for an executable file with that name in the current