python - 如何使用 python 将列表中的数据框名称更改为字符串?
问题描述
如何使用 python 将列表中的数据框名称更改为字符串?
list = [a,b,c,d]
# each element in the list is a dataframe
# I wanna change this list into
["a","b","c","d"]
解决方案
你可以使用这个:
def get_df_name(df):
return [x for x in globals() if globals()[x] is df][0]
l = [a,b,c]
l = list(map(get_df_name,l))
推荐阅读
- java - 使用函数参数创建可重复使用的按钮
- c# - C# 忽略“ProcessWindowStyle.Hidden;”?
- python - 获取两个系列之间的交集时出错
- python - 熊猫系列操作
- core-js - core-js3 找不到 core-js/client/shim.min.js
- python - 是否可以在 AWS S3 Select 的“where”子句中提及所有列?
- angular - 生成发布文件时不进行更改。角 8
- javascript - Strapi 关系,返回除 id 以外的其他字段
- reactjs - `getScriptTags` 上的可加载/组件 React SSR 抛出错误
- machine-learning - 如何在 Julia 中将矩阵附加到向量