Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用一个函数来聚合大量数据,我想知道是否有办法将文本作为函数的一部分插入到数据框名称中?
例如,在 SAS 中,我会使用一个“@”符号,它可用于在函数中插入文本。
def function (year): df@year = '@year' return df@year
当然这不会输出到数据框,所以在这种情况下是变量名,但是当我使用该函数时,我不必使用例如function(df2007, '2007')
function(df2007, '2007')