技术学校面试该说什么

技术面试 (Technical Interviews)

前言 (Preface)

I know a lot of people get nervous in interviews. Similarly, 8 out of 10 times in my interviews, I get ants in my pants. This meant forgetting the usual tricks I have in my pocket or missing some of the key knowledge I should have known. Recently, I did an on-site technical interview for a Business Intelligence internship role, and guess what? It was all: Pandas! Though the interview did not go as smoothly as I expected, I wanted to turn this experience into a reflection on what I think is crucial in Pandas, typically text data manipulation.

我知道很多人在面试中会变得紧张。 同样,在我的访谈中,十分之八的时间,我的裤子里都有蚂蚁。 这意味着忘记我口袋里的惯用技巧,或者错过一些本该知道的关键知识。 最近,我对一个商业智能实习职位进行了现场技术面试,您猜怎么着? 就是这样:熊猫! 尽管面试并不像我预期的那样顺利,但我想将这次经历转化为对我认为对Pandas至关重要的事情的反思,通常是文本数据操作。

总览 (Overview)

This article will be on “Working with Text Data in Pandas, mainly functions in the “pandas.Series.str”. Most of the problem settings are similar to what I experience during the interview. As you go over the article, you will get the opportunity to review what you have learned and receive a friendly reminder if you are looking forward to a technical interview. If you are new to Pandas, I hope you can add the tricks illustrated in this article to your data science toolkit. Let’s get started and clean our way towards more structured data.

本文将在“使用文本数据工作中熊猫 ”,主要功能在“pandas.Series.str”。 大多数问题设置与我在面试中遇到的情况类似。 在阅读本文时,如果您希望进行技术面试,您将有机会回顾所学内容并得到友好的提醒。 如果您不熟悉Pandas,希望您可以将本文中介绍的技巧添加到数据科学工具包中。 让我们开始吧,为更结构化的数据而清理思路。

Pandas in the Taipei Zoo, Source: Me
台北动物园的熊猫,资料来源:我

仅供参考: (FYI:)

  • The article will be sorted into small problem sets and possible solutions following those problems (or what I used to tackle each problem).本文将分类为小问题集,并提供针对这些问题(或我用来解决每个问题的解决方案)的可能解决方案。
  • This data set is a made-up sales data of “The Fruit” company to illustrate the possible scenarios you will be challenged in interviews, jobs, or data projects.

    该数据集是“水果”公司的虚构销售数据,用于说明您在面试,工作或数据项目中可能面临的挑战。

sales data of “The Fruit” company, Source: Me
“水果”公司的销售数据,来源:我
  • The data is preloaded and saved in df, and don’t forget to:

    数据已预加载并保存在df中 ,请不要忘记执行以下操作:

import pandas as pd

Without further ado, let’s get started!

事不宜迟,让我们开始吧!

To start off, the interviewer handed you a dataset of The Fruit’s sales division. You were asked to tackle problems in each column with your technical ability in Python. What did you find?

首先,面试官向您提供了The Fruit销售部门的数据集。 您被要求使用Python的技术能力来解决每列中的问题。 你发现了什么?

Sales_ID:奇怪的感叹号和冗余空间 (Sales_ID: Weird Exclamation Mark and Redundant Spaces)

If we take a look at the first row in the Sales_ID column, you will find that it contains unnecessary spaces and an exclamation mark for the ID itself. That is a problem since we don’t need those redundant characters in the Sales_ID column.

如果我们查看Sales_ID列中的第一行,您会发现它包含不必要的空格和ID本身的感叹号。 这是一个问题,因为我们在Sales_ID列中不需要那些多余的字符。

df[ 'Sales_ID'][0]Out: 'AU_1382578        !'

What we can do is utilize the pandas.Series.str.strip method in Pandas! strip() trims off the leading and trailing characters of the column. There are also small variants like rstrip() for right strip and lstrip() for left strip.

我们可以做的是利用Pandas中的pandas.Series.str.strip方法! strip()修剪列的开头和结尾字符。 也有一些小的变体,例如rstrip()用于右侧带, lstrip()用于左侧带。

It is very useful to use strip() when you have unessential characters and symbols on two sides of the data. Here we first right strip the “!” and then strip spaces on both sides.

当数据的两侧都有不必要的字符和符号时,使用strip()很有用。 在这里,我们首先右移“!” 然后在两侧都去除空格。

df['Sales_ID'] = df['Sales_ID'].str.rstrip('!').str.strip()
Sales_ID, Source: Me
Sales_ID,来源:我

Congrats on cleaning the Sales_ID column!

祝贺您清理Sales_ID列!

Sales_Branch:缺少? 一点特征工程 (Sales_Branch: Missing? A little Feature Engineering)

Seems like the Sales_Branch column is totally missing! The interviewer asked you to fix it with hints from the Sales_ID column. After a quick check, you find that sales are assigned to branches of The Fruit based on the first 2 words of the Sales_ID.

似乎完全缺少Sales_Branch列! 面试官要求您使用Sales_ID列中的提示来修复它。 快速检查后,您发现根据Sales_ID的前两个单词将销售分配给The Fruit的分支。

We can use the pandas.Series.str.slice method to slice the key elements of the string. For instance: ‘AU_1382578in Sales_ID → ‘AU’ in Sales_Branch.

我们可以使用pandas.Series.str.slice 分割字符串的关键元素的方法。 例如: Sales_ID中的“ AU_1382578 Sales_Branch 中的“ AU”

slice() contains 3 parameters:

slice()包含3个参数:

  • start: where to start with a default of 0

    start:从哪里开始,默认为0

  • stop: where to stop (exclusive)

    停止:在哪里停止(独家)

  • step: how far a step with a default of 1

    step:默认值为1的步长

df['Sales_Branch'] = df['Sales_ID'].str.slice(stop=2)
Sales_Branch, Source: Me
Sales_Branch,来源:我

Congrats on feature engineering the Sales_Branch column!

恭喜您对Sales_Branch列进行了特征工程!

产品说明:包含要出售的产品的详细说明 (Product_Description: Long Descriptions containing which Products are Sold)

Probably on most occasions, the company’s system produces a transaction log with long sentences. But the sentences contain valuable information that your interviewer is asking for.

在大多数情况下,该公司的系统可能会生成带有长句子的交易日志。 但是这些句子包含面试官要求的有价值的信息。

df['Product_Description'][0]Out: 'The Fruit, a company that sells fruits from all over the world, has branches in Australia, the United Kingdom, the United States, and Taiwan. Product: Apple Mango Banana Watermelon Orange Blueberry Banana Watermelon Kiwifruit'

We can see that while all of the first sentences were identical, we can split this into 2 columns: Description and Product. This is where the pandas.Series.str.split method comes into play.

我们可以看到,虽然所有的第一句话都是相同的,但我们可以将其分为两列:描述和产品。 这是pandas.Series.str.split的地方 方法起作用。

split() contains 3 parameters:

split()包含3个参数:

  • pat: what to split on with a default of white space ‘ ’

    pat:使用默认空白''分割的内容

  • n: the users can specify how many splits they want

    n:用户可以指定他们想要多少个分割

  • expand: when expand=True, the splits are put into individual columns

    expand:当expand = True时,拆分将放入单独的列中

df['Product_Description'].str.split(' Product: ', expand=True)
Source: Me
资料来源:我

We can assign the 0 and 1 to Description and Product in 2 ways:

我们可以通过2种方式将0和1分配给Description和Product:

df['Description'] = df['Product_Description'].str.split(' Product: ', expand=True)[0]df['Product'] = df['Product_Description'].str.split(' Product: ', expand=True)[1]

or

要么

df[['Description', 'Product']] = df['Product_Description'].str.split(': ', expand=True)
Photo by Karoline Stk on Unsplash
Karoline Stk在Unsplash上拍摄的照片

Now, the interviewer gets picky and added an additional requirement: sort the list of products in the Product column.

现在,面试官变得挑剔并增加了一个附加要求:在“产品”列中对产品列表进行排序。

No need to feel anxious! This can be done by first splitting values in the Product column with split() and then apply the sorted function in Python.

无需感到焦虑! 这可以通过首先使用split()拆分Product列中的值,然后在Python中应用排序后的函数来完成。

df['Product'] = df['Product'].str.split().apply(sorted)
Description and Product, Source: Me
说明和产品,来源:我

Congrats on getting information out of the Product_Description column!

祝贺您从Product_Description列中获取信息!

Product_Count:每个销售员的水果数 (Product_Count: The Number of Fruits for each Salesperson)

The interviewer wanted to get a sense of the variety of fruits that their salespeople are selling. It’s good to know that you can also use the pandas.Series.str.len method to get the length of lists in the Product column.

面试官想了解他们的销售人员正在出售的各种水果。 很高兴知道您也可以使用pandas.Series.str.len 获取“产品”列中列表长度的方法。

df['Product_Count'] = df['Product'].str.len()

Let’s find out who sells the most variety of fruits in The Fruit!

让我们找出谁在《水果》中出售最多样的水果!

df[df['Product_Count'] == max(df['Product_Count'])]
Source: Me
资料来源:我

It seems like the Australian representatives who sell 10 different fruits is the winner!

似乎卖出10种不同水果的澳大利亚代表就是赢家!

Congrats on counting the variety of fruits in the Product_Count column!

恭喜您在Product_Count栏中计算水果的种类!

产品:不仅仅是产品列表 (Product: More than just lists of Products)

So after getting Product out of Product_Description, there is another challenge in your way! The interviewer asked if you could split up the Product column in 2 manners:

因此,将产品从Product_Description中删除后,您面临的另一个挑战是! 面试官问您是否可以通过两种方式拆分“产品”列:

  1. Split the column into Product_1, Product_2, …将列拆分为Product_1,Product_2等
  2. Do one-hot encoding on each product对每个产品进行一次热编码
Photo by Tom Grünbauer on Unsplash
TomGrünbauer在Unsplash上的照片

1.将此列拆分为Product_n (1. Split this column into Product_n)

We can easily cope with this challenge by utilizing pd.Series, which we can turn a list of products into pandas.core.frame.DataFrame.

我们可以利用pd.Series轻松应对这一挑战,我们可以将产品列表转换为pandas.core.frame.DataFrame

Products = df['Product'].apply(pd.Series)Products

Then we finish our work by renaming the column names!

然后,我们通过重命名列名来完成我们的工作!

Products = Products.rename(columns=lambda x: 'Product_'+str(x))Products
10 rows × 9 columns, Source: Me
10行×9列,来源:我

2.对每个产品进行一次热编码 (2. Do one-hot encoding on each product)

One-hot encoding in Pandas is called pandas.Series.str.get_dummies, which is used to give each product a column of its own.

Pandas中的一键编码称为pandas.Series.str.get_dummies ,用于为每个产品提供独立的列。

get_dummies() has only 1 parameter:

get_dummies() 只有1个参数:

  • sep: what to split on with a default of ‘|’

    sep:要分割的内容,默认为“ |”

We are using the original form from the split because we can use whitespace to separate them. (Fill free to try using the list form with a loop!)

我们使用拆分中的原始表单,因为我们可以使用空格将它们分开。 (可随意尝试使用带有循环的列表表单!)

df['Product_Description'].str.split(': ', expand=True)[1]
Product separated by whitespace, Source: Me
产品以空格分隔,来源:我

By applying get_dummies(), we get the 10 rows × 27 columns of each fruit from the operation (that is huge!).

通过应用get_dummies() ,我们从操作中获得每个水果的10行×27列(这是巨大的!)。

Products2 = df['Product_Description'].str.split(': ', expand=True)[1].str.get_dummies(' ')Products2
10 rows × 27 columns, Source: Me
10行×27列,来源:我

After acing the 2 requirements, the interviewer finally decided to pick option 1 as the final version. We can merge Products (option 1) with the original data frame df, resulting in a shape of 10 rows × 17 columns.

在满足了2个要求之后,访调员最终决定选择选项1作为最终版本。 我们可以将Products(选项1)与原始数据框df合并,从而得到10行×17列的形状。

df = pd.concat([df, Products], axis=1)

仅供参考: (FYI:)

The scikit-learn library also provides a “MultiLabelBinarizer” with the same function, but that is another story.

scikit-learn库还提供了具有相同功能的“ MultiLabelBinarizer ”,但这是另一回事了。

Congrats on separating each fruit from the Product column!

祝贺您将每个水果从“产品”列中分离出来!

最近销售日期:一年一月的一天 (Recent_Sales_Date: Just Year-Month-Day)

We are almost done with our interview, one last task is on data time duties. The interviewer asks you to turn the Recent_Sales_Date column into a “year-month-day” format. That is to further prevent future operations in selecting dates with different output times.

采访几乎完成了,最后一项任务是数据时间职责。 面试官要求您将“最近的销售日期”列转换为“年-月-日”格式。 这是为了进一步防止将来在选择具有不同输出时间的日期时进行操作。

First, we cut out the dates we want, which can be accomplished in 2 ways:

首先,我们切出所需的日期,这可以通过两种方式完成:

Dates = df['Recent_Sales_Date'].str[:10]

or

要么

Dates = df['Recent_Sales_Date'].str.slice(stop=10)
Photo by Mille Sanders on Unsplash
Mille Sanders在Unsplash上拍摄的照片

Second, simply wrap it inside pd.to_datetime().

其次,只需将其包装在pd.to_datetime()中

df['Recent_Sales_Date'] = pd.to_datetime(Dates)
Recent_Sales_Date, Source: Me
最近销售日期,来源:我

Congrats on reformatting date time in the Recent_Sales_Date column!

恭喜,您可以在“最近的销售日期”列中重新格式化日期时间!

结语 (Epilogue)

The interview process is officially over! Congrats! I hope that this article provides you with the experience that I had with my 1st technical interview. Though I did not do that well on this one, this won’t be the last one as well! Now, we are more confident in text data manipulation in Pandas. Thank you all for joining in the ride!

面试过程正式结束! 恭喜! 我希望本文能为您提供我第一次技术面试中的经验。 尽管我在这方面做得不好,但这也不是最后一个! 现在,我们对Pandas中的文本数据操作更有信心。 谢谢大家的参与!

For a short review, the strip(), slice(), split() methods are all useful tools when dealing with text data: You could choose to strip off irrelevant parts on two sides, slice the essential parts that could be used, and divide the data according to a splitting criterion.

简短地回顾一下, strip()slice()split()方法在处理文本数据时都是有用的工具:您可以选择在两侧剥离不相关的部分,对可以使用的基本部分进行切片,以及根据拆分标准划分数据。

Here is the Github repo for all the codes in the article!

这是文章中所有代码的Github存储库 !

I love to learn about data and reflect on (write about) what I’ve learned in practical applications. You can contact me via LinkedIn and Twitter if you have more to discuss. Also, feel free to follow me on Medium for more data science articles to come!

我喜欢学习数据并反思(写)我在实际应用中学到的东西。 如果您还有其他需要讨论的地方,可以通过LinkedIn和Twitter与我联系。 另外,请随时关注我的“中型”,以获取更多数据科学文章!

Come play along in the data science playground!

快来在数据科学游乐场玩吧!

翻译自: https://towardsdatascience.com/pandas-what-ive-learned-after-my-1st-on-site-technical-interview-4fb94dbc1b45

技术学校面试该说什么


http://www.taodudu.cc/news/show-2806254.html

相关文章:

  • 吴恩达 02.改善深层神经网络:超参数调试、正则化以及优化 第一周作业
  • deeplearning.38序列模型(搭建RNN与LSTM应用实践)
  • 应用时间线服务器启动报错_从服务器到无服务器的时间轴和教程
  • wamp环境二次配置
  • [网络安全自学篇] 七十五.Vulnhub靶机渗透之bulldog信息收集和nc反弹shell(三)
  • 【Docker学习笔记 三】Docker常用容器安装及图形化管理工具
  • 【CTF】记录一次CTF比赛的Writeup(附题目下载地址)
  • 栈溢出练习(1)
  • 如何学习
  • IDEA精选插件使用,建议收藏
  • html表头解释_1分钟内解释的html
  • Advanced SystemCare Pro 中文绿色特别便携正式版一款易于使用的 Windows 电脑优化工具
  • CTFlearn-misc(fore/prog)-wp(3)
  • Congrats !
  • 【076】朴素贝叶斯介绍
  • ffmpeg rtmp推流
  • 使用ffmpeg读取本地文件,进行推流
  • obs多推流地址_OBS如何进行多路推流
  • 直播--android端推流实现一
  • ffmpeg rtmp推流代码示例
  • Nginx推流负载均衡配置
  • rtmp推流和拉流
  • 拉流与推流的区别_RTSP协议交互流程之推流分析
  • java rtmp推流_视频直播生成推流和播放地址的Java代码示例
  • 抓rtmp推流地址_在浏览器中实现RTMP推流
  • 搭建推流服务器
  • 推流地址 java_如何通过代码生成推流地址和播放地址?
  • 推流拉流RMTP方案:Nginx+ffmpeg/obs+vlc/h5
  • java 推流_使用java执行ffmpeg命令进行推流操作
  • ffmpeg C++推流

技术学校面试该说什么_我第一次现场技术面试后,香港专业教育学院学到了什么...相关推荐

  1. 前端面试的作品示例_如何回答任何技术面试问题-包括示例

    前端面试的作品示例 Technical interviews can be extremely daunting. From the beginning of each question to the ...

  2. 解决浏览器兼容性问题面试题_如果不解决技术面试问题,就无法解决技术多样性问题。 这是数据。...

    解决浏览器兼容性问题面试题 by Aline Lerner 通过艾琳·勒纳(Aline Lerner) 如果不解决技术面试问题,就无法解决技术多样性问题. 这是数据. (You can't fix d ...

  3. python开发面试问题及答案_集锦 | 53个Python面试问题 答案打包带走

    作者丨Chris来源丨AI科技大本营(ID:rgznai100)链接丨https://towardsdatascience.com/53-python-interview-questions-and- ...

  4. 【面试招聘】聊聊求职过程中的技术面试

    2020年的下半年开始了,很多大学都已经放了暑假,开始准备去找实习工作了,很多2021年毕业的同学也开始了秋招的进程,而对于一些社招人员,疫情结束,年终奖拿完,也开始准备跳槽.最近一段时间,无论是实习 ...

  5. 【2020-07】字节跳动面试凉经(年轻人的第一场 技术面试)

    字节跳动面试 比较坎坷的经历 2019年12月份报名过字节跳动的日常实习 当时可能就是想试试 连简历筛选都没过 也是啥也不会 即使半年多 过去了 也是啥也不会 但是知道 应该干点啥了 所以连在线笔试都 ...

  6. python开发面试问题及答案_前50个Python面试问题(最受欢迎)

    热门Python面试问答 下面列出的是关于Python编程语言的最常见面试问题和答案. 让我们探索!! #1)Python可以用于Web客户端和Web服务器端编程吗?哪一个最适合Python? 答案: ...

  7. mysql面试简历怎么写_如何写简历和面试,才能提前锁定offer?

    针对这些内容,我在完全不了解面试者的情况下,刚刚拿到这份简历之后,我可能会问出的问题如下:>>如果你需要免费.高颜值专业的简历模板,请点击这下面<< ▲应届生实习生模板 iOS ...

  8. java面试不会怎么办_【必须录用】面试遇到不会回答的问题,该怎么办?

    一. 前言 今天给大家讲讲面试过程当中最长遇到的窘境,也是最能体现一个候选人临场应变能力的地方,那就是当我们在面试的过程当中,遇到的问题回答不上来的时候,该怎么办. 二. 误区 在开始讲解之前,先纠正 ...

  9. java开发面试自我介绍模板_(自我介绍范文)java面试自我介绍

    1 java 面试自我介绍 java 技术具有卓越的通用性,高效性,平台移植性和安全性,当今已广泛应用于各种电子设备和互联网, 因此 java 公司具备了广泛的优势和广阔的发展前景.下面百分网为大家整 ...

最新文章

  1. ubuntu 10.04 安装arm交叉编译器
  2. Java运行时动态加载类之ClassLoader
  3. qc linux mysql 安装教程_linux下安装mysql
  4. 关于node.js和C交互的方法
  5. 安装TPCC-MySQL报错
  6. 接口定义【领域对象】
  7. React事件的问题
  8. 伪响应式开发(PC和Mobile分离)
  9. JS获取指定月的前N个月数据
  10. Unity中文博主频道列表
  11. matlab powf,科学网—MZDDE中操作数更正 - 张凯元的博文
  12. kafka安装和部署
  13. 使用rest_framework的routers模块添加路由
  14. 到西藏工作,出差,旅行,出游,体验,好奇一切的一切,大全科 绝对是经典 教科书 类,上面见不到的 全面了解,西藏的生活
  15. ctf题库--1000
  16. MFC字体磅数与像素CImage
  17. Play-Utils:一个专门为 Play Framework 开发的实用工具包模块
  18. SpringBoot配置多数据源数据库
  19. html5--导航栏制作
  20. dz3.2火车头 php接口,DiscuzX3.4论坛火车头采集器免登陆发布模块(附测试接口)!...

热门文章

  1. Head First Statistics one 做图规则
  2. 【DB笔试面试758】在Oracle的DG中,Switchover和Failover的区别有哪些?
  3. 唯品会财报:一面骄阳,一面寒霜
  4. 【AndroidManifest.xml详解】Manifest属性之versionCode,versionName
  5. OpenGL 入门 17:立方体贴图
  6. “咔咔咔”手机拍照过新年 是时候了解下背后的技术了
  7. 阿拉伯数字转中文 JAVA
  8. 计算机基础学到了哪些知识,计算机基础学习心得
  9. 直入樱花深处,静待落英满襟
  10. 致:同年代的童真童鞋们