简体   繁体   English

如何将现有的 df 添加到 class

[英]How to add an existing df into a class

I have an existing dataframe called df that I need to be imported into this class. Am I allowed to do that and how does it work?我有一个名为 df 的现有 dataframe,我需要将其导入到这个 class 中。我可以这样做吗?它是如何工作的?

def __init__(self,df):

    self.df = df
    
    

the output I get is:

<__main__.solar_model object at 0x7fa1a37ae7c0>

You can access the member Dataframe by calling您可以拨打会员Dataframe

solar_model.df

this will return the Dataframe. You could use it like print(solar_model.df) to print the Dataframe to the console.这将返回 Dataframe。您可以像print(solar_model.df)一样使用它来将 Dataframe 打印到控制台。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM