Avatto>>DATA SCIENTIST>>SHORT QUESTIONS>>Python Interview Questions
In Python, we can use dict data type to store key value pairs. In this example, customer name can be the key and their location can be the value in a dict data type.
Dictionary is an efficient way to store data that can be looked up based on a key.
Output of this will be John Smith This is an example of Slicing. Since we are slicing at the same index, the first name[:5] gives the substring name upto 5th location excluding 5th location. The name[5:] gives the rest of the substring of name from the 5th location. So we get the full name as output.
The output of this code is following:
Even though the list has only 2 elements, the call to thelist with index 3 does not give any index.
Some of the popular libraries of Python used for Data analysis are:
Pandas: Powerful Python Data Analysis Toolkit
SciKit: This is a machine learning library in Python.
Seaborn: This is a statistical data visualization library in Python.
SciPy: This is an open source system for science, mathematics and engineering implemented in Python.
To execute a Python script in Unix, we need to have Python executor in Unix environment.
In addition to that we have to add following line as the first line in a Python script file.
This will tell Unix to use Python interpreter to execute the script.