How to store the result of df.count() as a new dataframe in Pandas?

Tim Williams tjandacw at gmail.com
Wed Oct 27 06:25:29 EDT 2021


On Tue, Oct 26, 2021 at 6:36 PM Shaozhong SHI <shishaozhong at gmail.com>
wrote:
> Hello,
>> The result of df.count() appears to be a series object. How to store the
> result of df.count() as a new dataframe in Pandas?
>> That is data anyhow.
>> Regards,
>> David
> --
> https://mail.python.org/mailman/listinfo/python-list

Have you tried something like
df_count = pd.DataFrame(df.count())
?
(Untested, but I've converted Series objects to DataFrames doing something
similar before.)
This is more of a pandas question. Why don't you ask this on stackoverflow?
https://stackoverflow.com/questions/tagged/pandas


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /