背景
我正在尝试获取数据框的形状。我使用 "pd.read_csv" 从csv文件中读取数据到数据框中,然后尝试获取其维度。
代码
file_name = 'xxxxxx.csv'
with open(file_name, 'r') as f:
metadata_location = [i for i, x in enumerate(f.readlines()) if 'Metadata' in x]
with open(file_name, 'r') as f:
data = pd.read_csv(f, index_col=False, skipfooter=26)
print(data.shape())
错误
TypeError: 'tuple' object is not callable
如何解决这个问题?
其他检查
print(type(data))
<class 'pandas.core.frame.DataFrame'>
data = pd.read_csv(file_name, index_col=False, skipfooter=26)
即可,无需打开。 - luigigi