{ "cells": [ { "cell_type": "code", "execution_count": 3, "id": "dbcb3eba", "metadata": {}, "outputs": [], "source": [ "with open('network.txt', 'r') as f:\n", " data = f.read()" ] }, { "cell_type": "code", "execution_count": 14, "id": "99a29887", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "from matplotlib.dates import DateFormatter\n", "plt.rcParams['font.family'] = 'SimHei' #" ] }, { "cell_type": "code", "execution_count": 15, "id": "357f39a6", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "<>:1: SyntaxWarning: invalid escape sequence '\\s'\n", "<>:1: SyntaxWarning: invalid escape sequence '\\s'\n", "C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_28148\\4043059997.py:1: SyntaxWarning: invalid escape sequence '\\s'\n", " df = pd.read_csv('network.csv', sep='\\s{2,}',engine='python',\n" ] } ], "source": [ "df = pd.read_csv('network.csv', sep='\\s{2,}',engine='python', \n", " names=['日期', '耗时'])" ] }, { "cell_type": "code", "execution_count": 16, "id": "c2b5be98", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | 日期 | \n", "耗时 | \n", "
|---|---|---|
| 0 | \n", "2025-05-26 10:20:04 | \n", "3896 | \n", "
| 1 | \n", "2025-05-26 10:30:03 | \n", "3441 | \n", "
| 2 | \n", "2025-05-26 10:31:00 | \n", "300 | \n", "
| 3 | \n", "2025-05-26 10:32:00 | \n", "305 | \n", "
| 4 | \n", "2025-05-26 10:33:00 | \n", "292 | \n", "
| ... | \n", "... | \n", "... | \n", "
| 1334 | \n", "2025-05-27 08:48:01 | \n", "1547 | \n", "
| 1335 | \n", "2025-05-27 08:49:00 | \n", "404 | \n", "
| 1336 | \n", "2025-05-27 08:50:00 | \n", "479 | \n", "
| 1337 | \n", "2025-05-27 08:51:00 | \n", "931 | \n", "
| 1338 | \n", "2025-05-27 08:52:00 | \n", "325 | \n", "
1339 rows × 2 columns
\n", "