Sign Up Now!

Sign up and get personalized intelligence briefing delivered daily.


Sign Up

Articles related to "function"


Pandas Sidetable: A Smarter Way of Using Pandas

  • It provides numerous functions and methods that are quite useful in data analysis.
  • For instance, the second row of cumulative columns shows the count and percentage of the middle and young categories.
  • What we see in the returned table is the sum of the “AmountSpent” column for each category.
  • The other columns contain the data (percentage, cumulative) based on the values in the “AmountSpent” column.
  • It returns the count and percentage of missing values in each column.
  • However, it comes in handy when we work with dataframes that contain missing values in most columns.
  • Let’s first do a groupby example without the subtotal function of sidetable.
  • Sidetable is a great tool to create summary tables which are quite useful in exploratory data analysis.
  • What sidetable offers can also be created using the Pandas own functions and methods.

save | comments | report | share on


Concurrency: Implement withUnsafe[Throwing]Continuation by slavapestov · Pull Request #34916 · apple/swift

  • GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
  • Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
  • Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
  • These new functions are implemented in terms of two new built-ins, Builtin.withUnsafe[Throwing]Continuation(), which traffic in a new Builtin.RawUnsafeContinuation type.
  • In order for the library wrappers to lower to the same SIL as direct usage of the builtins, I marked the wrappers as @_alwaysEmitIntoClient, and also added explicit @_alwaysEmitIntoClient initializers to Unsafe[Throwing]Continuation<T>.
  • I changed the SIL instructions to traffic in the new Builtin.RawUnsafeContinuation type rather than Unsafe[Throwing]Continuation<T>.
  • Instead, the wrapping of the continuation value in a Unsafe[Throwing]Continuation<T> is handled elsewhere, in the library code and SILGen's bridging logic.

save | comments | report | share on


SQL Unit Testing in BigQuery? Here is a tutorial

  • The second one will test the logic behind the user-defined function (UDF) that will be later applied to a source dataset to transform it.
  • I would do the same with long SQL queries, break down into smaller ones because each view adds only one transformation, each can be independently tested to find errors, and the tests are simple.
  • It’s a nice and easy way to work with table data because you can pass into a function as a whole and implement any business logic you need.
  • I will now create a series of tests for this and then I will use a BigQuery script to iterate through each testing use case to see if my UDF function fails.
  • Instead it would be much better to user BigQuery scripting to iterate through each test case’s data, generate test results for each case and insert all results into one table in order to produce one single output.

save | comments | report | share on


AWS Lambda now supports container images as a packaging format

  • You can use familiar container development tools such as Docker CLI to locally build and test your Lambda based application, and push your container image to Amazon ECR - a fully-managed container registry.
  • With this launch, AWS provides a set of base images for Lambda that are available on ECR Public and Docker Hub. You can also build and deploy your function using your preferred base images.
  • We have open-sourced a set of software packages, Runtime Interface Clients (RIC), that implement the Lambda Runtime API, allowing you to seamlessly extend your preferred base images to be Lambda compatible.
  • To make it easy to locally test Lambda functions packaged as container images we open-sourced a lightweight web-server, Lambda Runtime Interface Emulator (RIE), which allows your function packaged as a container image to accept HTTP requests.
  • RIE is included in the AWS Lambda provided base images, and is open sourced on GitHub for use with your preferred images.

save | comments | report | share on


15 Examples to Master Python Lists vs Sets vs Tuples

  • Lists, tuples, and sets are 3 important types of objects.
  • The functions that changes a collection (e.g. append, remove, extend, pop) are not applicable to tuples.
  • Although tuples are immutable, they can contain mutable elements such as lists or sets.
  • By default, the pop function removes the last item from a list and returns it.
  • When used on a set, the pop function removes an arbitrary item since there is no index or order in a set.
  • The functions to use are, as the names suggest, list, tuple, and set.
  • Since tuples are immutable, we can only add new items to a list or set.
  • For instance, append method adds an item at the end of a list.
  • We have multiple options to combine objects of lists, tuples, and sets.
  • So we can use it to create a sorted list based on a tuple.

save | comments | report | share on


AWS Lambda – Functions with Up to 10 GB of Memory and 6 VCPUs

  • Since Lambda charges are proportional to memory configured and function duration (GB-seconds), the additional costs for using more memory may be offset by lower duration.
  • With more memory and CPU power, and support for the AVX2 instruction set, new use cases — such as machine learning applications; batch and extract, transform, load (ETL) jobs; modelling; genomics; gaming; high-performance computing (HPC); and media processing — become easier to implement and scale with Lambda functions.
  • For example, looking at the graph above, when I configure 5 GB of memory, I have the same costs as when I have 1 GB of memory (about $61 for one million invocations), but the function is 5x faster.
  • You can configure up to 10 GB of memory for new or existing Lambda functions using the AWS Management Console, AWS Command Line Interface (CLI), AWS SDKs, and Serverless Application Model.

save | comments | report | share on


AWS Lambda pricing now per ms

  • You are charged based on the number of requests for your functions and the duration, the time it takes for your code to execute.
  • The AWS Lambda free usage tier includes 1M free requests per month and 400,000 GB-seconds of compute time per month.
  • When Provisioned Concurrency is enabled for your function and you execute it, you also pay for Requests and Duration based on the prices below.
  • If the concurrency for your function exceeds the configured concurrency, you will be billed for executing the excess functions at the rate outlined in the AWS Lambda Pricing section above.
  • The Lambda free tier does not apply to functions that have Provisioned Concurrency enabled.
  • If you enable Provisioned Concurrency for your function and execute it, you will be charged for Requests and Duration based on the price below.

save | comments | report | share on


New for AWS Lambda – Container Image Support | Amazon Web Services

  • We are providing base images for all the supported Lambda runtimes (Python, Node.js, Java, .NET, Go, Ruby) so that you can easily add your code and dependencies.
  • We are also releasing as open source a Lambda Runtime Interface Emulator that enables you to perform local testing of the container image and check that it will run when deployed to Lambda.
  • Using the AWS-Provided Base Image for Node.js Here’s the code (app.js) for a simple Node.js Lambda function generating a PDF file using the PDFKit module.
  • You can use container image support in AWS Lambda with the console, AWS Command Line Interface (CLI), AWS SDKs, AWS Serverless Application Model, and solutions from AWS Partners, including Aqua Security, Datadog, Epsagon, HashiCorp Terraform, Honeycomb, Lumigo, Pulumi, Stackery, Sumo Logic, and Thundra.

save | comments | report | share on


AWS Lambda – Pricing

  • You are charged based on the number of requests for your functions and the duration, the time it takes for your code to execute.
  • The AWS Lambda free usage tier includes 1M free requests per month and 400,000 GB-seconds of compute time per month.
  • When Provisioned Concurrency is enabled for your function and you execute it, you also pay for Requests and Duration based on the prices below.
  • If the concurrency for your function exceeds the configured concurrency, you will be billed for executing the excess functions at the rate outlined in the AWS Lambda Pricing section above.
  • The Lambda free tier does not apply to functions that have Provisioned Concurrency enabled.
  • If you enable Provisioned Concurrency for your function and execute it, you will be charged for Requests and Duration based on the price below.

save | comments | report | share on


Lambda Calculus with Brainfuck for side effects

  • Edit2: I think the "." And " ' " operations can be performed using pure lambda calculus, so I'm going to leave them in but score them out.
  • It also means you can have long variable names and even whole function definitions as parameters, which could probably work normally, but it means you can also define things on separate lines of you'd like to format the code better.
  • Usually having "=" for assigning functions to variables isn't a part of lambda calculus, and it isn't really clear how it would function syntactically.
  • Strictly speaking the functions in lambda calculus always takes exactly one argument, although it is common to include syntactic sugar for currying.

save | comments | report | share on