分类 Technology 中的文章
10 Tips to Improve Your Python Data Analysis Skills
Serialization and Deserialization in Python
pickle, including file-based examples, dumps() and loads(), and one important safety warning for real-world use.……
Python Data Visualization - The Post-2000 Gaokao Generation
charts and pyecharts.……
Parallelism in One Line of Python Code
map combined with thread or process pools can make simple parallelism much lighter for everyday scripts, especially with multiprocessing.dummy for IO-bound work.……
Longest Palindromic Substring Algorithm - Manacher
Len array that allow it to run in $O(n)$ time.……
Finding Common Values in Two Python Lists
Python Implementation of Classic Sorting Algorithms (1)
Faceswap Training Resource Acquisition and Processing
Detailed Examples of Seaborn Plotting Kernel Density Curves
In a frequency distribution histogram, when the sample size is sufficiently enlarged to its limit, and the bin width is infinitely shortened, the step-like broken line in the frequency histogram will evolve into a smooth curve. This curve is called the density distribution curve of the population.
This article walks through how to use Seaborn with the Iris dataset in Pandas to plot several common kinds of kernel density curves.
1. Basic Density Curve
import seaborn as sns
import pandas as pd
sns.set(color_codes=True)
sns.set_style("white")
df = pd.read_csv('iris.csv')
sns.kdeplot(df['sepal_width'])

To plot a kernel density curve using Seaborn, you only need to use kdeplot. Note that a density curve only requires one variable; here we choose the sepal_width column.
2. Density Curve with Shading
import seaborn as sns
import pandas as pd
sns.set(color_codes=True)
sns.set_style("white")
df = pd.read_csv('iris.csv')
sns.kdeplot(df['sepal_width'], fill=True)

Detailed Explanation of Faceswap Deep Learning AI for Video Face Swapping
Drawing a Stunning "Dream of the Red Chamber" Word Cloud with Python 3
Word clouds, which I’m sure you’ve all seen, are created using wordcloud, a famous Python library. This article will detail how to use wordcloud to create a word cloud for “Dream of the Red Chamber,” one of China’s Four Great Classical Novels.
1. Preparation
This involves three parts:
1. Install wordcloud and jieba
You can install them with pip install wordcloud and pip install jieba.
2. Prepare a Chinese font file
3. Prepare the text file
The .txt file and the font file are bundled so this example is easier to reproduce.
2. Drawing the “Dream of the Red Chamber” Word Cloud
Here’s the code directly:
from wordcloud import WordCloud
import jieba
import matplotlib.pyplot as plt
text = "".join(jieba.cut(open("红楼梦.txt").read()))
wordcloud = WordCloud(font_path="kaibold.ttf").generate(text)
# Display the generated image:
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis("off")
plt.margins(x=0, y=0)
plt.show()

最新文章
- Use just to Manage Project Commands: Turn Repeated Scripts into a Runnable Menu
- Electron in Practice: Building an M3U8 Video Downloader
- Beginner Guide: Auto-build and Deploy a Hugo Site with GitHub Actions
- Codex Project Rules: Use AGENTS.md to Keep AI Coding Consistent
- Python Log Triage: Use rg and uv to Find Nginx 5xx Errors Fast
- Connect Codex to LiteLLM with Nginx as One Model Gateway
- Write Self-Contained Python Scripts with uv and PEP 723
- Build a Sky Flap Browser Game with Phaser: Source Download to Local Run
- Secure Python MCP Server: Add Boundaries to AI Tool Calls
- 2026 Practical Python Workflow: Replace pip, venv, and pipx with uv