Python

WHAT ARE SOME OF THE MOST COMMON LIBRARIES IN PYTHON?
The most popular Python data analysis libraries are as follows: Pandas \NumPy \sciPy \TensorFlow \SciKit \seaborn \Matplotlib

HOW WOULD YOU FIND DUPLICATE VALUES IN A DATASET FOR A VARIABLE IN PYTHON?
With the Pandas duplicated() method, you may search for duplicates. This will give you a boolean series that is TRUE only for elements that are unique. DataFrame.duplicated(subset=None,keep=’last’) Keep in this case chooses what to deal with duplicates. You may utilise: First – The first value is regarded as unique, while the others are duplicates. The last value is regarded as unique, whereas the other values are seen as duplicates. False – Treats identical values as duplicates.

WHAT IS THE USE OF A LAMBDA FUNCTION IN PYTHON?
The lambda function, sometimes referred to as an “anonymous function,” is identical to a regular function but is not specified with the keyword. The keyword serves to define them. Similar to regular functions, lambda functions are limited to a single line of expression and accept many parameters.

WHAT’S THE DIFFERENCE BETWEEN / AND // IN PYTHON?
They are both division operators: / and //. /, on the other hand, performs float division by splitting the first operand in half. The value is returned in decimal form. // divides the first operand by the second to compute the floor, but returns the result in natural number form.
/ example: 9 / 2 returns 4.5
// example: 9 / 2 returns 4

WHAT’S THE DIFFERENCE BETWEEN MUTABLE AND IMMUTABLE OBJECTS?
If or not an object’s value can change, it is mutable or immutable in Python. These values can be altered by mutable objects, but not by immutable objects. Lists, sets, dictionaries, and byte arrays are some examples of mutable data types. Immutable data types include strings, frozensets, tuples, and numeric data types (boolean, float, etc.).

WHAT ARE SOME OF THE LIMITATIONS OF PYTHON?
Python has some significant limitations, such as:
a) Python is slower than languages like Java and C++, according to studies. A custom
b) runtime is one way to make Python faster, though.
c) Python 2 and Python 3 cannot be used together.
d) Python is excellent for desktop and server apps, but it is less strong for mobile development.
Memory use – Python is not recommended for applications that require lots of memory.

IS PYTHON A LANGUAGE THAT EMPHASISES OBJECTS?
Describe the term “object-oriented programming.”  Certainly, Python may contain the codes within the objects because it is an object-oriented programming language. The property enables the object to include both the data and the method as a single entity.

WHAT IS A PYTHON MODULE? HOW IS IT DIFFERENT FROM LIBRARIES?
A module is a single file (or set of files) that contains variables, definitions, and functions that are intended to carry out specific duties. The file has a.py extension. It just needs to be imported once and may be done at any moment throughout a session. There are two ways to import a Python module: import and from module name import. The ability to do a range of activities without having to write the code is made possible by libraries, which are collections of reusable programming functionality. There is no defined context for a Python library. It vaguely alludes to a group of modules. You can utilise these codes by importing the library and invoking a method (or attribute) from it with a period (.)

WHAT ARE COMPOUND DATA TYPES AND DATA STRUCTURES?
Compound data types are created by combining simple, primitive, and basic data types. Python data structures let us store numerous observations. They consist of dictionaries, sets, tuples, and lists.

WHAT IS TUPLE UNPACKING? WHY IS IT IMPORTANT?
A tuple can be broken down into its component parts in the following ways: We have the tuple x = (600, 350) The following two new variables can be assigned to this tuple: a,b = x The output of printing letters a and b is now: print(a) = 600 and print(b) = 350. To separate each value one at a time, use the triple unpacking method. The output of machine learning algorithms typically comes in the form of a tuple. The unpacking feature of tuples can be used if, for example, x = (avg, max) and we want to use these values individually for additional analysis.

WHAT ARE GENERATORS AND DECORATORS?
A function that returns an iterable or object that can be iterated, or taken one value at a time, is called a generator. We can change or modify the classes, methods, and functions with the aid of decorators.

WHAT IS THE DIFFERENCE BETWEEN ‘IS AND ‘==’ ?
‘==’ checks for equality between the variables, and ‘is’ checks for the identity of the variables.

WHAT IS THE DIFFERENCE BETWEEN INDEXING AND SLICING?
Slicing obtains a series of elements, whereas indexing extracts or looks up one or more specific values in a data structure.

WHAT IS THE DIFFERENCE BETWEEN DEL(), CLEAR(), REMOVE(),  AND POP()?
With respect to the position of the value, del() deletes the. The removed value is not returned. Moreover, it reduces the index by one value, moving it to the right. Moreover, the whole data structure can be deleted using it.
List clearing with clear().
If you know which specific value to delete, you can use the function remove() because it deletes with respect to the value.
pop(): by default returns the value that was deleted together with the last element that was removed. It is frequently employed for creating referencing. It makes sense to save this erased return value to a variable for later usage.

WHAT IS PYTHONPATH?
When a module is imported, this environment variable is used. When a module is imported, PYTHONPATH is also checked to see if the imported modules are present in any other directories. It is used by the interpreter to choose which module to load.

IS INDENTATION REQUIRED IN PYTHON?
For Python, indentation is necessary. It designates a section of code. The code for all loops, classes, functions, and other structures is contained in an indented block. Typically, four space characters are used. If your code is not indented properly, it will not run correctly and will also produce errors.

HOW DO PASS, CONTINUE, AND BREAK OPERATE?
Break: When a condition is met, the loop can be broken, and control is then passed on to the following statement.
Continue:  Permits skipping a portion of a loop when a certain condition is satisfied and control is returned to the loop’s beginning.
Pass: Used when you want to skip the execution of a block of code but you need it syntactically. In essence, this is a null operation. When this is used, nothing occurs.

WHAT IS PICKLING AND UNPICKLING?
Pickling is the process of taking any Python object and turning it into a string representation and dumping it into a file using the dump function. Unpickling is the process of obtaining the original Python objects from the stored string representation.

HOW WILL YOU CAPITALISE THE FIRST LETTER OF THE STRING?
The capitalise() method in Python capitalises the first character in a string. It returns the original string if the string already has a capital letter at the beginning.

WHAT IS THE DIFFERENCE BETWEEN LISTS AND TUPLES IN PYTHON?
Tuples are enclosed in parenthesis, and lists are enclosed in square brackets.
Lists are changeable, which implies they can be changed after being formed, as opposed to immutable objects. Tuples cannot be changed since they are immutable.
Operations: Compared to tuples, lists offer more functions, such as sorting and insert and pop operations.
Tuples are immutable, thus they utilise less memory, which makes them faster in terms of size.