Develop Data Visualization Interfaces in Python With Dash

# app.py import pandas as pd from dash import Dash, Input, Output, dcc, html data = ( pd.read_csv(“avocado.csv”) .assign(Date=lambda data: pd.to_datetime(data[“Date”], format=”%Y-%m-%d”)) .sort_values(by=”Date”) ) regions = data[“region”].sort_values().unique() avocado_types = data[“type”].sort_values().unique() external_stylesheets = [ { “href”

Read more

Python’s multiprocessing performance problem

Because Python has limited parallelism when using threads, using worker processes is a common way to take advantage of multiple CPU cores. The multiprocessing module is built-in to the standard library, so it’s frequently used for this purpose. But while multiple processes let you take advantage of multiple CPUs, moving data between processes can be very slow. And that can reduce some of the performance benefits of using worker processes. Let’s see: Why processes can have performance problems that threads […]

Read more

How to Flush the Output of the Python Print Function

Do you want to build a compact visual progress indicator for your Python script using print(), but your output doesn’t show up when you’d expect it to? Or are you piping the logs of your script to another application, but you can’t manage to access them in real time? In both cases, data buffering is the culprit, and you can solve your troubles by flushing the output of print(). In this tutorial, you’ll learn how to: Flush the output data […]

Read more

Getters and Setters in Python

If you come from a language like Java or C++, then you’re probably used to writing getter and setter methods for every attribute in your classes. These methods allow you to access and mutate private attributes while maintaining encapsulation. In Python, you’ll typically expose attributes as part of your public API and use properties when you need attributes with functional behavior. Even though properties are the Pythonic way to go, they can have some practical drawbacks. Because of this, you’ll […]

Read more

Python News: What’s New From January 2023

The new year has arrived, and January brought a flurry of new and interesting Python enhancement proposals (PEPs). Topics range from f-string formalization and no-GIL Python to packaging. There’s been ample discussion on the Python Discourse forum about the implications of these PEPs, and if you’re still a bit wary of diving deeper into the discussions, then you can get a softer introduction here. There have also been a couple of noteworthy new releases, first and foremost the fourth alpha […]

Read more

How to Split a Python List or Iterable Into Chunks

Splitting a Python list into chunks is a common way of distributing the workload across multiple workers that can process them in parallel for faster results. Working with smaller pieces of data at a time may be the only way to fit a large dataset into computer memory. Sometimes, the very nature of the problem requires you to split the list into chunks. In this tutorial, you’ll explore the range of options for splitting a Python list—or another iterable—into chunks. […]

Read more

Research Focus: Week of February 6, 2023

Welcome to Research Focus, a new series of blog posts that highlights notable publications, events, code/datasets, new hires and other milestones from across the research community at Microsoft. In this article Behind the Tech podcast with Tobi Lütke: CEO and Founder, Shopify In the latest episode of Behind the Tech, Microsoft CTO Kevin Scott is joined by Tobi Lütke, CEO and founder  

Read more

Otázky a odpovědi o ChatGPT a velkých jazykových modelech

Poslední dobou se v médiích poměrně často píše o ChatGPT a jazykových modelech a mám pocit, že ne úplně všechno se říká úplně správně. Proto jsem připravil několik otázek a odpovědí, které snad pomůžou vyjasnit, o čem se to vlastně mluví. Otázky: Co je to (velký) jazykový model? Co je to ChatGPT? Je GPT-3.5 a ChatGPT to nejlepší, co existuje? Jsou nějaké dostupné alternativy, ideálně open source? Jaktože umí ChatGPT česky, používá strojový překlad? Kde se berou znalosti, které má ChatGPT? […]

Read more
1 158 159 160 161 162 989