用php做购物网站视频,网页微博怎么下载视频,米课的wordpress,wordpress python导入新手入坑。 通常我们需要把公共函数提出来#xff0c;作为公共资源调用。也避免了代码的重复书写。
比如我们在项目内创建我们的py脚本路径如下#xff1a; 在公共方法中定义方法#xff1a;
class CommonMethods:def dataFormat(df):dataList []for row in range(0, df.…新手入坑。 通常我们需要把公共函数提出来作为公共资源调用。也避免了代码的重复书写。
比如我们在项目内创建我们的py脚本路径如下 在公共方法中定义方法
class CommonMethods:def dataFormat(df):dataList []for row in range(0, df.shape[0]):dataList.append({})for col in range(0, df.shape[1]):col_name df.columns.values[col]dataList[row][col_name] df.loc[row, col_name]return dataList
在其他脚本中调用如下
import akshare as ak
from Common.CommonMethod import CommonMethods //from 文件路径 import自己定义的类stock_board_change_em_df ak.stock_board_change_em()
dataCommonMethods.dataFormat(stock_board_change_em_df)//此处直接调用即可
print(str(data))