假设一个DataFrame中有数百列.有些列名是小写的,有些是大写的.
现在,我想将所有列转换为大写.
import polars as pl
df = pl.DataFrame({
"foo": [1, 2, 3, 4, 5, 8],
"baz": [5, 4, 3, 2, 1, 9],
})
我try 了什么:
df.columns = [x.upper() for x in df.columns]
它起作用了,但有没有其他方法,最好不使用for循环?