Python Interview Questions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

- What is Pandas used for?

o Data analysis and data manipulation o High level data structures o Good for graphs, charts, tables and pivot tables

- What is a function? Give an example for a Python function and a user defined function.

o Functions are used to utilize code in more than one place in a program You can do this by using a def statement to define the function o Def my_function (): Print("hi my name is CJ") return My_function()

- What is a dataframe?

o Is a 2-dimensional labeled data structure with columns of potentially different types. o It is like a spreadsheet in excel or a SQL table o Used most commonly in pandas

- What is Anaconda?

o It is a free open source distribution of Python and R programming languages for scientific computing o It aims to simplify package management and deployment

- What does REGEX stand for?

o Regular Expression

- What are the two statistics for shape?

o Skew and kurtosis

- What is the difference between a for and a while loop?

o The While loop allows you to repeatedly execute a block of statements as long as the condition is true o The for loop iterates over a sequence of objects, it goes through each sequence, but unlike a while loop it does not continue to loop through the blocks until the condition is met.

- What are the three option of controlling the flow of a program?

o The if statement o The while statement o The for loop

- What are the three statistics for central tendency?

o Three most common measures are mean, median and mode.

- What are the two statistics for variation?

o Variance and Standard Deviation

- What is a dictionary in Python; when would you use it?

o A dictionary maps a set of objects like the keys to another set objects that are the values. o Maps unique keys to values o Dictionaries are mutable meaning that they can be changed.

- What is a module?

o A module is a file consisting of Python code like a source file Can define functions, classes and variables Can include runnable code o When imported from another Python source file the file name is treated as a namespace.

- What is the difference between a list and a tuple?

o A tuple is immutable meaning that whatever is in it cannot be edited. o A list is mutable meaning that whatever is in the list can be edited.

- What do you check for when you receive a data set to make sure that the data is clean?

o Check if there is missing data (null) o Drop data if needed o Fill data if needed o Remove duplicates o Replace values such as spelling o Check types - make sure it matches

- What is Pandas?

o Is a software library for Python for data manipulation and analysis. o It offers data structures and operations for manipulating numerical tables and time series. o Designed to make working with data both easy and intuitive o Really good for visual data comparison

- What is numpy?

o Is dependent upon the panda's library but offers scientific computation o It integrates C++ code o Helps support large multidimensional arrays and matrices with a collection of high-level mathematical function to operate on these arrays.

- What are the different option to handle missing data?

o Isnull() to display the missing values in the dataframe o .dropna() will drop the missing values in the dataframe o .fillna() will fill all the missing values with a replacement value

- What are the benefits of using Jupyter notebooks?

o It excels in the form of programming called literate programming. User friendly text o Excels at demonstration, research and teaching objects where it is really easy to read and see exactly what you are doing. o It is also open source web application that allows you to create and share documents with live code, equations, visualizations and explanatory text. o Good for modeling visuals o Good for STEM

- What are regular expressions used for?

o It is a special sequence of characters that helps you match or find out other strings or sets of strings. Uses a special syntax held in a pattern. o Helps you match, locate and manage text if you need to clean a file to make it more readable. Similar to find and replace function

- What is a pivot table?

o It is a table that summarizes data such as means and different measurements o They can be used to find unique values o This is a good way to quickly see all the values that appear in a field and also find typos

- Why is it important to know the file format?

o It is important to know the file format when exporting and importing files to make sure they will be read correctly. o When importing files into jupyter notebooks The code is different than for an excel file or txt or csv. o When exporting files it is important to export the file in the format that matches the persons program like jupyter notebook. Make sure it is in a general python file if you are not sure the specific destination.

- What is Python?

o Python is an interpreted, high-level, general purpose programming language. o Python has a design philosophy that emphasizes code readability while using significate amount of whitespace. o Provides clear programming for both large and small scales.

- Is Python a compiled or an interpreted language? What does that mean?

o Python would follow under a byte code interpreted language o Interpreted language is the type of programming language for most of its implementations execute instructions directly and freely, without previously compiling a program into a machine-language instructions like Java and C++.

- What is the difference between a line and a scatter plot?

o Scatter plot shows how much one variable is affected by another By having point displayed all over the chart o Line graphs are like scatter plots in that they record individual data values as marks on the graph. Shows a line fit of the points.

- What does the if-statement do?

o The if statement is used to check a condition if the condition is true, we run a block of statements. The else clause is optional only if you want to add another alternative that is different.

- What is the difference between ASCII and Unicode?

o The main difference is the way they encode the character and number of bits that they use o ASCII originally used 7 bits to encode each character Defines 128 characters o Unicode uses a variable bit encoding program where you choose between 32, 16 and 8 bit encodings. Defines less than 2^21 characters Subset of ASCII Numbers have the same meaning as ASCII

- What are the two option of using a single quote in a string?

o When there is ' ' where it reads the string but you will have to indicate a \ for '. o When there is " " where is reads the whole string whether or not there is a ' in the string.

- What does a join do? Give an example when you would use a join.

o You join when you have two different tables and you want to compare the different tables. It combines the two tables into one table o You use a join when comparing a table that shows the different employees names and you want to see who sold the most cars. You join the car table and the employee table to see the results.

- What function would you use to summarize a group?

o You would use a group by function normally followed by an aggerate function


Kaugnay na mga set ng pag-aaral

International Business 3450 Chapter 3 Quiz

View Set

Exam 2 Chapter Ending Quizzes 5-8

View Set

Pharmacology HESI Practice Questions

View Set

Five Practices of Exemplary Leadership Model

View Set

NF20 CHP13 &14 Produce & Legumes

View Set