运放 单电源 双电源

    科技2023-12-28  75

    运放 单电源 双电源

    Cleaning, wrangling and summarizing. I don’t know about you but I enjoy this process of data analysis. Power Query is the main tool I use for this. I’ll be writing more about Power Query in the future.

    清洁,整理和总结。 我不了解您,但是我喜欢这个数据分析过程。 Power Query是我为此使用的主要工具。 我将在以后写更多有关Power Query的文章。

    I clean because the data is dirty. I clean because I want good data for analysis. I wrangle to get the right “shape” for joins to work. It’s dreadful if you have to clean data manually and it’s prone to cleaning errors. Imagine error on top of errors? What will you really be analyzing?

    我清理是因为数据很脏。 我清理是因为我想要好的数据进行分析。 我努力争取合适的“形状”来进行连接工作。 如果您必须手动清理数据,这很可怕,并且容易出现清理错误。 试想在错误之上出现错误? 您真正要分析的是什么?

    Don’t worry. Functions — much like those cute little robots on top can come to the rescue.

    不用担心功能-就像顶部的那些可爱的小机器人一样可以抢救。

    Image by author 图片作者

    What exactly is a function anyways? A quick google search gives this definition.

    函数到底是什么? 快速谷歌搜索给出了这个定义。

    “A function is a block of organized, reusable code that is used to perform a single, related action. … Different programming languages name them differently, for example, functions, methods, sub-routines, procedures, etc.”

    “功能是一组有组织的可重用代码,用于执行单个相关操作。 ……不同的编程语言对它们的命名不同,例如函数,方法,子例程,过程等。”

    The keyword here is reusable. It has to be reusable for it to be a function. That means you can use this code and apply it to not just one file but other files as well. I think of a function as something that takes inputs, performs a custom set of procedures, and gives an output.

    此处的关键字是可重用的。 它必须是可重用的,才能成为一种功能。 这意味着您可以使用此代码并将其不仅应用于一个文件,而且还应用于其他文件。 我认为函数是一种需要输入,执行一组自定义过程并提供输出的东西。

    A lot of what you use today, for example, the sum function in Power BI to the joins are functions.

    您今天使用的很多东西,例如Power BI中连接的sum函数都是函数。

    For example — take a look at this function in M (Power Query Language)

    例如-看一下M(超级查询语言)中的此功能

    Image from author 图片来自作者

    The problem is…sometimes we don’t have functions that are available to us that quite meet our needs. We want to apply a custom set of procedures to various files. This is why and when we have to use it.

    问题是……有时我们没有可以满足我们需求的可用功能。 我们要对各种文件应用一组自定义过程。 这就是为什么以及何时必须使用它。

    Let’s go through how to create functions in Power BI in Power Query. With all the cleaning and wrangling in life, I’m sure this will be very useful to us.

    让我们看一下如何在Power Query中的Power BI中创建函数。 有了生活中的所有清洁和挣扎,我相信这对我们非常有用。

    As the stick figure mentioned, We have several different files across the years. we need to perform these same actions across all the files.

    简而言之,这些年来我们有几个不同的文件。 我们需要对所有文件执行相同的操作。

    Image by author 图片作者

    We don’t want to do this procedure to each one of the files but we want the function to do this for us.

    我们不想对每个文件都执行此过程,但是我们希望函数为我们执行此过程。

    To get started, let’s load in all our files in a folder.

    首先,让我们将所有文件加载到一个文件夹中。

    image by author 图片作者

    After you’ve loaded all your files, you should see them displayed as below.

    加载所有文件后,应该看到如下所示。

    Let’s start by creating a “Duplicate” of the main file — we want to build a function from this duplicate.

    让我们从创建主文件的“副本”开始-我们要从该副本中构建函数。

    Image by author 图片作者

    Now that there is a duplicate, we keep only the first row to build the function.

    现在有一个重复项,我们仅保留第一行来构建函数。

    Image by author 图片作者

    Power BI keeps only the first row. Nice.

    Power BI仅保留第一行。 真好

    Image by author 图片作者

    Here is a neat and important trick — you can type in [Content] which refers to the column and {0} which refers to the actual “cell” itself. If you have more of a technical understanding, I am referring to the column and returning a list, then referring to the list value 0 to return the binary file.

    这是一个巧妙而重要的技巧-您可以键入[Content]来引用该列,并键入{0}来引用实际的“单元格”本身。 如果您有更多的技术知识,我将参考该列并返回一个列表,然后参考列表值0以返回二进制文件。

    If you don’t like typing, you can also click on “drill down” on the binary file itself.

    如果您不喜欢输入,也可以在二进制文件本身上单击“向下钻取”。

    Image by author 图片作者

    Power BI neatly loads the file without those automatic transformations.

    Power BI会巧妙地加载文件,而无需那些自动转换。

    Image by author 图片作者

    Now let’s do our quick summary using group by. You can find “Group By” under the Transform Ribbon on the top of the pane.

    现在,让我们使用分组依据进行快速总结。 您可以在窗格顶部的“转换”功能区下找到“分组依据”。

    Image by author 图片作者

    Here is our result for one of the files.

    这是其中一个文件的结果。

    Image by author 图片作者

    This is exactly what we need.

    这正是我们所需要的。

    Hmm… stick figures.

    嗯...简笔画。

    image by author 图片作者

    Not done yet, let’s make it into an actual function.

    尚未完成,让我们将其变为实际功能。

    You can do this by going to the Advance Editor option under the Transform Ribbon.

    您可以通过转到“变形”功能区下的“高级编辑器”选项来执行此操作。

    Power BI records all the steps and turns it into an M script for us. If you are familiar with Excel, it’s like a recorded macro. we just need to change the reference so that it can be applied to other files.

    Power BI记录了所有步骤,并为我们将其转换为M脚本。 如果您熟悉Excel,它就像一个录制的宏。 我们只需要更改引用即可将其应用于其他文件。

    You don’t need to know how to type out all the M code below. The beauty of Power BI is that it records all these steps for you. I will be writing a bit more about how to read M scripts in the near future.

    您不需要知道如何键入下面的所有M代码。 Power BI的优点在于它可以为您记录所有这些步骤。 我将在不久的将来写更多关于如何阅读M脚本的内容。

    This is the current script.

    这是当前脚本。

    let Source = Folder.Files("MY_DRIVE"), #"Removed Top Rows" = Table.Skip(Source,1), #"Removed Other Columns" = Table.SelectColumns(#"Removed Top Rows",{"Name", "Content"}), #"Kept First Rows" = Table.FirstN(#"Removed Other Columns",1)[Content]{0}, #"Imported CSV" = Csv.Document(#"Kept First Rows",[Delimiter=",", Columns=5, Encoding=65001, QuoteStyle=QuoteStyle.None]), #"Promoted Headers" = Table.PromoteHeaders(#"Imported CSV", [PromoteAllScalars=true]), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Year", Int64.Type}, {"Sex", type text}, {"Name", type text}, {"Job Title", type text}, {"Salary", Int64.Type}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Year", "Sex"}, {{"Average Salary", each List.Average([Salary]), type nullable number}}), #"Rounded Off" = Table.TransformColumns(#"Grouped Rows",{{"Average Salary", each Number.Round(_, 0), type number}})in #"Rounded Off"

    Don’t let this overwhelm you, the only thing we care about is the Csv.Document part.

    不要让这让您不知所措,我们唯一关心的就是Csv.Document部分。

    Let’s remove everything above the Csv.Document part and declare our variable. I chose (X as binary) because we want this function to have a binary input.

    让我们删除Csv.Document部分上方的所有内容并声明我们的变量。 我选择(X作为二进制)是因为我们希望此函数具有二进制输入。

    Remember all those csv files on the folder? They are binary files.

    还记得文件夹中所有的csv文件吗? 它们是二进制文件。

    Image by author 图片作者

    This is our function!

    这是我们的功能!

    Image by author 图片作者

    Now let’s apply this to our files. Let’s “invoke” our custom function. You can find “invoke” under the “add column” ribbon.

    现在,将其应用于我们的文件。 让我们“调用”我们的自定义函数。 您可以在“添加列”功能区下找到“调用”。

    Sounds like something out of Harry Potter right?

    听起来像是哈利·波特的作品吧?

    Image by author 图片作者

    Here it is!

    这里是!

    Image by author 图片作者

    Let’s hit expand for our final table.

    让我们点击扩展进入决赛桌。

    Image by author 图片作者

    Ta-da!

    -

    Male and Female by average salary by year.

    男性和女性按年平均工资。

    Now, this is a simple data set but you can also build in joins and other much more complex transformations into a function and apply it to all the files.

    现在,这是一个简单的数据集,但是您也可以将联接和其他更复杂的转换构建为一个函数,并将其应用于所有文件。

    TL:DR? I built this for you.

    TL:DR吗? 我为你建造了这个。

    Image by author 图片作者

    Hope you’ve enjoyed this article.

    希望您喜欢这篇文章。

    If you’d like to watch a video instead — Curbal is a channel that has really taught me a lot about functions and of course Power BI.

    如果您想观看视频,那么Curbal是一个频道,它确实教会了我很多功能,当然还有Power BI。

    Stay safe and hope this helps you with your journey with data!

    保持安全,希望这对您的数据旅行有所帮助!

    翻译自: https://towardsdatascience.com/functions-in-power-bi-56e9e11e4669

    运放 单电源 双电源

    相关资源:将双电源运放电路改为单电源电路
    Processed: 0.013, SQL: 8