Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14011

Create new instance with old instance which we do not know the constructor parameter

$
0
0

I have a new class called DataSheet which is inherit from Pandas.

class DataSheet(DataFrame):    def __init__(self, name=None, **kwargs):        super().__init__(**kwargs)        self.name = name

The initial dataFrame comes from pd.read_excel().Is it possible construct new DataSheet instance with pandas directly?

Currently, my solution is

DataSheet(    name=k,    data=v.to_dict(),    index=v.index,    columns=v.columns,)

There is a same question about FT4222doc.

I want to wrtie a new class (eg. my_FT4222) inherent FT4222 and I can get the instance by ft4222.openByDescription.

Can I use the instance comes from ft4222.openByDescription to create my_FT4222?


Viewing all articles
Browse latest Browse all 14011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>