随笔分类 -  python

1 2 3 4 5 ··· 25 下一页
python学习
摘要:#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 阅读(32) 评论(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 阅读(90) 评论(0) 推荐(0)
摘要:https://curlconverter.com/ 阅读全文
posted @ 2024-11-18 20:19 myrj 阅读(250) 评论(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 阅读(91) 评论(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 阅读(197) 评论(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 阅读(83) 评论(0) 推荐(0)
摘要:mypip opencv-python 阅读全文
posted @ 2024-08-30 15:59 myrj 阅读(20) 评论(0) 推荐(0)
摘要:https://googlechromelabs.github.io/chrome-for-testing/#stable webdriver最新版下载 阅读全文
posted @ 2024-08-10 20:04 myrj 阅读(134) 评论(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 阅读(87) 评论(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 阅读(11) 评论(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 阅读(30) 评论(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 阅读(1073) 评论(0) 推荐(0)
摘要:1.windows安装jupyterpip install jupyter2.运行cmd,切换到.ipynb文件所在的文件夹3.CMD,运行命令jupyter notebook4.如果电脑中安装了两个版本的python,分别是python37 python311,则需要根据path中的路径判断利用哪 阅读全文
posted @ 2024-07-12 08:30 myrj 阅读(281) 评论(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 阅读(245) 评论(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 阅读(31) 评论(0) 推荐(0)
摘要:按“位置”寻址有时被称为“位置索引”,这只是增加了混淆。 一对方括号是不够的。特别是: S[2:3]不是解决元素2最方便的方式 如果名称恰好是整数,s[1:3]就会产生歧义。它可能意味着名称1到3包含或位置索引1到3不包含。 为了解决这些问题,Pandas还有两种“风格”的方括号,你可以在下面看到: 阅读全文
posted @ 2024-02-12 05:49 myrj 阅读(94) 评论(0) 推荐(0)
摘要:pandas.DataFrame是矩形格式,为了定位每行、每列、每个元素,可以通过行名列名确定。 中英文描述性的行名、列名称为label; 而0,1,2,3,4,5…等数字称为position; 通过label或position都可以定位元素,但是有些函数在定位时只能用label,有些只能用posi 阅读全文
posted @ 2024-02-12 05:46 myrj 阅读(51) 评论(0) 推荐(0)

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