创建了一个空的DataFrame,名为self.top_disease_data,它的列名称与字典self.data的选定键名称相同,但是它没有任何行数据
时间: 2024-05-13 18:20:41 浏览: 58
以下是创建空的DataFrame的Python代码:
```python
import pandas as pd
class MyClass:
def __init__(self):
self.data = {"disease1": [1, 2, 3], "disease2": [4, 5, 6], "disease3": [7, 8, 9]}
self.top_disease_data = pd.DataFrame(columns=self.data.keys())
my_object = MyClass()
print(my_object.top_disease_data)
```
输出:
```
Empty DataFrame
Columns: [disease1, disease2, disease3]
Index: []
```
阅读全文