Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20353
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <f.pollastri@inrim.it> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.014 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'ok.': 0.04; 'classes.': 0.05; 'suppose': 0.05; 'defines': 0.07; 'python': 0.08; 'substitute': 0.09; 'columns': 0.16; 'series.': 0.16; 'subject:package': 0.16; 'instance': 0.18; 'subject:problem': 0.19; 'header:In-Reply-To:1': 0.22; 'classes': 0.26; 'import': 0.27; 'class': 0.29; 'skip:p 30': 0.29; 'clear,': 0.30; 'header :User-Agent:1': 0.33; 'named': 0.33; 'frame': 0.34; 'to:addr :python-list': 0.35; '...': 0.35; 'extend': 0.36; 'two': 0.36; 'class.': 0.37; 'some': 0.38; 'data': 0.38; 'returned': 0.39; 'to:addr:python.org': 0.40; 'follow': 0.61; 'more': 0.61; 'skip:n 30': 0.64; 'series': 0.67; 'received:10.10': 0.68; 'fabrizio': 0.84; 'matrix': 0.84 |
| X-Virus-Scanned | amavisd-new at sisrv6.intra.inrim.it |
| Date | Mon, 13 Feb 2012 18:53:27 +0100 |
| From | Fabrizio Pollastri <f.pollastri@inrim.it> |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.26) Gecko/20120131 Thunderbird/3.1.18 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: package extension problem |
| References | <19027093.1215.1329153496662.JavaMail.geo-discussion-forums@ynel5> |
| In-Reply-To | <19027093.1215.1329153496662.JavaMail.geo-discussion-forums@ynel5> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5765.1329155611.27778.python-list@python.org> (permalink) |
| Lines | 62 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1329155611 news.xs4all.nl 6857 [2001:888:2000:d::a6]:55878 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:20353 |
Show key headers only | View raw
Ok. To be more clear, consider the real python package Pandas.
This package defines a Series class and a DataFrame class.
The DataFrame is a matrix that can have columns of
different type.
If I write
import pandas as pd
df = pd.DataFrame({'A':[1,2,3],'B':[4,5,6]})
a data frame with two cols named A and B is created.
If I write
col_A = df['A']
the returned col_A is an instance of Series.
Now , let suppose that I want to extend some functionality of pandas
by adding new methods to both Series and DataFrame classes.
One way to do this is to redefine this classes in a new package
(new_pandas) as follow
import pandas as pd
class Series(pd.Series):
...
add new methods
...
class DataFrame(pd.DataFrame):
...
add new methods
...
When I use the new package as a pandas substitute and write
import new_pandas as np
df = np.DataFrame({'A':[1,2,3],'B':[4,5,6]})
col_A = df['A']
col_A is an instance of the original pandas and not of the new pandas,
losing all the added functionality.
Fabrizio
Now, how can I add new methods to extend the functionality of pandas
classes Series and DataFrame
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
package extension problem Fabrizio Pollastri <f.pollastri@inrim.it> - 2012-02-12 19:46 +0100
Re: package extension problem Miki Tebeka <miki.tebeka@gmail.com> - 2012-02-13 09:18 -0800
Re: package extension problem Fabrizio Pollastri <f.pollastri@inrim.it> - 2012-02-13 18:53 +0100
Re: package extension problem Miki Tebeka <miki.tebeka@gmail.com> - 2012-02-13 09:58 -0800
Re: package extension problem Terry Reedy <tjreedy@udel.edu> - 2012-02-13 14:12 -0500
Re: package extension problem Miki Tebeka <miki.tebeka@gmail.com> - 2012-02-13 09:58 -0800
Re: package extension problem Peter Otten <__peter__@web.de> - 2012-02-13 19:28 +0100
Re: package extension problem Miki Tebeka <miki.tebeka@gmail.com> - 2012-02-13 09:18 -0800
csiph-web