随笔分类 -  python

1 2 3 4 5 ··· 25 下一页
python学习
摘要:class Human: def __init__(self,name,age): self.name,self.age=name,age def __str__(self): return f'{self.age}岁的{self.name}' def __repr__(self): return 阅读全文
posted @ 2025-12-09 21:00 myrj 阅读(2) 评论(0) 推荐(0)
摘要:cap:mkdir 0119h cd "F:\BaiduNetdiskDownload\1973~2024 年降水量面板数据(含栅格数据)\区县" fs *.xlsx local ci=0 foreach file in `r(files)'{ import excel "`file'", shee 阅读全文
posted @ 2025-11-21 08:54 myrj 阅读(4) 评论(0) 推荐(0)
摘要:#stata 调用python 导入XLSX,导出时最多保留6位小数 python: import pandas as pd df = pd.read_excel(r"E:\statashu2\0224b\jieguo1.xlsx") df.to_excel(r"E:\statashu2\0224b 阅读全文
posted @ 2025-02-24 16:57 myrj 阅读(47) 评论(0) 推荐(0)
摘要:2的三次方:2**37除以3的整数商:7//3 取得numpy帮助: >>> import numpy as nphep>>> help(np)Help on package numpy: 阅读全文
posted @ 2025-02-22 06:16 myrj 阅读(6) 评论(0) 推荐(0)
摘要:import pandas as pd # 长格式数据 df_long = pd.DataFrame({ 'id': ['A', 'A', 'B', 'B', 'C', 'C'], 'year': [2020, 2021, 2020, 2021, 2020, 2021], 'value': [10, 阅读全文
posted @ 2025-01-03 20:59 myrj 阅读(98) 评论(0) 推荐(0)
摘要:https://curlconverter.com/ 阅读全文
posted @ 2024-11-18 20:19 myrj 阅读(260) 评论(0) 推荐(0)
摘要:mypip csvmatch 阅读全文
posted @ 2024-09-13 06:37 myrj 阅读(5) 评论(0) 推荐(0)
摘要:import pandas as pd # 假设你的SQL文件名为 'query.sql' sql_file_path = 'query.sql' # 使用read_sql_file读取SQL文件 df = pd.read_sql_file(sql_file_path) # 显示DataFrame 阅读全文
posted @ 2024-09-08 19:33 myrj 阅读(97) 评论(0) 推荐(0)
摘要:raise AttributeError("Can only use .dt accessor with datetimelike values") 日期时间两边有双引号,转换失败df1["year"]=pd.to_datetime(df1["insertTime"]).dt.year 需要替换掉两 阅读全文
posted @ 2024-09-08 15:53 myrj 阅读(232) 评论(0) 推荐(0)
摘要:DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead from selenium.webdriver.common.by import Bydriver = w 阅读全文
posted @ 2024-09-06 19:45 myrj 阅读(85) 评论(0) 推荐(0)
摘要:mypip opencv-python 阅读全文
posted @ 2024-08-30 15:59 myrj 阅读(24) 评论(0) 推荐(0)
摘要:https://googlechromelabs.github.io/chrome-for-testing/#stable webdriver最新版下载 阅读全文
posted @ 2024-08-10 20:04 myrj 阅读(139) 评论(0) 推荐(0)
摘要:import re def replace_urls(text): # 匹配http或https网址的正则表达式 url_pattern = re.compile(r'https?://[^\s]+') # 替换网址 return url_pattern.sub('', text) # 示例文本 t 阅读全文
posted @ 2024-08-08 20:29 myrj 阅读(103) 评论(0) 推荐(0)
摘要:import numpy as np a=np.array([1,2,3,4]) b=np.array([5,6,7,8]) #相应项相乘再相加 print(np.inner(a,b)) #a的每一项乘以b的每一项组成新的矩阵 print(np.outer(a,b)) 阅读全文
posted @ 2024-08-08 20:19 myrj 阅读(18) 评论(0) 推荐(0)
摘要:# -*- coding: utf-8 -*- # This code shows an example of text translation from English to Simplified-Chinese. # This code runs on Python 2.7.x and Pyth 阅读全文
posted @ 2024-08-06 10:26 myrj 阅读(38) 评论(0) 推荐(0)
摘要:import os file_path1 = '/path/to/file.txt' print("【执行】os.path.splitext(file_path1)") print(os.path.splitext(file_path1)) file_path2 = '/path/to/image. 阅读全文
posted @ 2024-07-24 08:48 myrj 阅读(28) 评论(0) 推荐(0)
摘要:报错: raise IllegalCharacterError(f"{value} cannot be used in worksheets.")openpyxl.utils.exceptions.IllegalCharacterError: 图尔荪托合提麦合苏提 cannot be used i 阅读全文
posted @ 2024-07-20 19:34 myrj 阅读(1130) 评论(0) 推荐(0)
摘要:1.windows安装jupyterpip install jupyter2.运行cmd,切换到.ipynb文件所在的文件夹3.CMD,运行命令jupyter notebook4.如果电脑中安装了两个版本的python,分别是python37 python311,则需要根据path中的路径判断利用哪 阅读全文
posted @ 2024-07-12 08:30 myrj 阅读(312) 评论(0) 推荐(0)
摘要:import re # 导入正则表达式处理模块 def get_phone(text): ''' 使用正则表达式提取文本中的手机号 :param text: 原始文本 :return: 手机号数组 ''' phones = re.findall(r'(13\d{9}|14[5|7]\d{8}|15\ 阅读全文
posted @ 2024-06-03 08:58 myrj 阅读(253) 评论(0) 推荐(0)
摘要:>>> s = pd.Series(np.zeros(10**6)) >>> s.index RangeIndex(start=0, stop=1000000, step=1) >>> s.index.memory_usage() # in bytes 128 # the same as for S 阅读全文
posted @ 2024-02-12 05:53 myrj 阅读(38) 评论(0) 推荐(0)

1 2 3 4 5 ··· 25 下一页