8/11/2023 0 Comments Sng tool to sort active tables![]() Python Coding Interview Question #6: Product Transaction Count The last step is to output the employee title, gender, and average total compensation, which you get by using the mean() function. Once you do that, you can get the total compensation by adding salary and bonus. Then you should merge the tables you have at your disposal. When answering this question, the first step should be to group by worker and bonus while using the sum() function to get the bonus per worker id. Output the employee title, gender (i.e., sex), along with the average total compensation.” Employee can receive more than one bonus. However, not every employee receives a bonus so disregard employees without bonuses in your calculation. Total compensation is calculated by adding both the salary and bonus of each employee. “Find the average total compensation based on employee titles and gender. Here, we have another question from the City of San Francisco: Python Coding Interview Question #5: Income By Title and Gender Merge = pd.merge(customers, orders, left_on="id", right_on="cust_id") Since you need the data from both tables, you’ll have to merge or inner join them: The second table is named orders with the following columns: id Output the customer id along with the first name and the lowest order price.” “Find the lowest order cost of each customer. We’ll do that to solve the Amazon question: One of the easiest ways to join two tables in Python is by using the merge() function. Python Coding Interview Question #4: Lowest Priced Orders However, as a data scientist, you’ll more often than not have to know how to write a query that pulls data from several tables. We selected these examples, so it’s easier for you to understand how aggregation, grouping, and ordering data in Python work. In all the previous examples, we were given only one table. Finally, use the sort_values to sort by variety in alphabetical order. To find the number of records per variety, use the count() function. First, you should group by the columns variety and sepal_length. This shouldn’t be hard to solve after the first two examples. Order records by the variety in ascending order.” Output the variety along with the corresponding number of records. “Find the total number of records that belong to each variety in the dataset. Python Coding Interview Question #3: Number Of Records By Variety Also, use the sort_values() to sort the output in descending order. Additionally, you have to group data on business_name and calculate the median for the inspection_score. Here, you should use the notnull() function to make sure you get only businesses that have the inspection score. In Postgres there is `percentile_disc` function available, however it's only approximation.” ![]() Try to come up with your own precise median calculation. Order records based on the inspection score in descending order. “Find the median inspection score of each business and output the result along with the business name. Here’s a question by the City of San Francisco: The previous question didn’t require any data grouping and ordering, unlike the following question by the City of San Francisco: Python Coding Interview Question #2: Inspection Scores For Businesses The question asked to output only this difference, so no other columns are needed. Table you need to use is box_scores, which has the following columns: idĪs a first step towards answering the question, you should sum the scores from all assignments:īox_scores = box_scores+box_scores+box_scoresīox_scores.max() - box_scores.min() Output just the difference in total score between the two students.” Write a query that identifies the largest difference in total score of all assignments. “You are given a table containing assignment scores of students in a class. ![]() Python Coding Interview Question #1: Class Performance We'll show you several practical examples to ensure you know what we’re talking about. They allow you to perform some mathematical operations and present your findings in a representable and user-friendly way. These three technical topics often come all together and they are fundamental to creating reports and doing any kind of data analysis. It goes without saying that these concepts are rarely tested separately, so by solving one question you’ll have to showcase your knowledge of multiple Python topics.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |