From 6b0989b24efba5999acf8fd71c12e8a1482d533c Mon Sep 17 00:00:00 2001 From: Saurav Chakravorty Date: Sun, 16 Dec 2018 15:20:57 +0530 Subject: [PATCH 1/2] DOC: Fixed whatsnew v12 --- doc/source/whatsnew/v0.12.0.rst | 36 ++++++++++++++++----------------- setup.cfg | 1 - 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/doc/source/whatsnew/v0.12.0.rst b/doc/source/whatsnew/v0.12.0.rst index f2816915955cf..6448ebc70cdeb 100644 --- a/doc/source/whatsnew/v0.12.0.rst +++ b/doc/source/whatsnew/v0.12.0.rst @@ -5,11 +5,6 @@ v0.12.0 (July 24, 2013) {{ header }} -.. ipython:: python - :suppress: - - from pandas import * # noqa F401, F403 - This is a major release from 0.11.0 and includes several new features and enhancements along with a large number of bug fixes. @@ -52,7 +47,7 @@ API changes .. ipython:: python - p = DataFrame({ 'first' : [4,5,8], 'second' : [0,0,3] }) + p = pd.DataFrame({'first': [4, 5, 8], 'second': [0, 0, 3]}) p % 0 p % p p / p @@ -66,10 +61,13 @@ API changes .. ipython:: python - df2 = DataFrame([{"val1": 1, "val2" : 20}, {"val1":1, "val2": 19}, - {"val1":1, "val2": 27}, {"val1":1, "val2": 12}]) + df2 = pd.DataFrame([{"val1": 1, "val2": 20}, + {"val1": 1, "val2": 19}, + {"val1": 1, "val2": 27}, + {"val1": 1, "val2": 12}]) + def func(dataf): - return dataf["val2"] - dataf["val2"].mean() + return dataf["val2"] - dataf["val2"].mean() # squeezing the result frame to a series (because we have unique groups) df2.groupby("val1", squeeze=True).apply(func) @@ -91,8 +89,8 @@ API changes .. ipython:: python - df = DataFrame(lrange(5), list('ABCDE'), columns=['a']) - mask = (df.a%2 == 0) + df = pd.DataFrame(lrange(5), list('ABCDE'), columns=['a']) + mask = (df.a % 2 == 0) mask # this is what you should use @@ -152,7 +150,7 @@ API changes .. code-block:: python from pandas.io.sql import read_frame - read_frame(....) + read_frame(...) - ``DataFrame.to_html`` and ``DataFrame.to_latex`` now accept a path for their first argument (:issue:`3702`) @@ -247,7 +245,7 @@ I/O Enhancements df = mkdf(5, 3, r_idx_nlevels=2, c_idx_nlevels=4) df.to_csv('mi.csv') print(open('mi.csv').read()) - pd.read_csv('mi.csv', header=[0,1,2,3], index_col=[0,1]) + pd.read_csv('mi.csv', header=[0, 1, 2, 3], index_col=[0, 1]) .. ipython:: python :suppress: @@ -264,10 +262,10 @@ I/O Enhancements In [25]: path = 'store_iterator.h5' - In [26]: DataFrame(randn(10,2)).to_hdf(path,'df',table=True) + In [26]: pd.DataFrame(np.random.randn(10, 2)).to_hdf(path, 'df', table=True) - In [27]: for df in read_hdf(path,'df', chunksize=3): - ....: print df + In [27]: for df in pd.read_hdf(path, 'df', chunksize=3): + ....: print(df) ....: 0 1 0 0.713216 -0.778461 @@ -342,7 +340,7 @@ Other Enhancements .. ipython:: python - sf = Series([1, 1, 2, 3, 3, 3]) + sf = pd.Series([1, 1, 2, 3, 3, 3]) sf.groupby(sf).filter(lambda x: x.sum() > 2) The argument of ``filter`` must a function that, applied to the group as a @@ -353,7 +351,7 @@ Other Enhancements .. ipython:: python - dff = DataFrame({'A': np.arange(8), 'B': list('aabbbbcc')}) + dff = pd.DataFrame({'A': np.arange(8), 'B': list('aabbbbcc')}) dff.groupby('B').filter(lambda x: len(x) > 2) Alternatively, instead of dropping the offending groups, we can return a @@ -424,7 +422,7 @@ Bug Fixes .. ipython:: python strs = 'go', 'bow', 'joe', 'slow' - ds = Series(strs) + ds = pd.Series(strs) for s in ds.str: print(s) diff --git a/setup.cfg b/setup.cfg index f9b4f27dda919..3cfec8d7f7d43 100644 --- a/setup.cfg +++ b/setup.cfg @@ -45,7 +45,6 @@ ignore = E402, # module level import not at top of file E703, # statement ends with a semicolon exclude = - doc/source/whatsnew/v0.12.0.rst doc/source/whatsnew/v0.13.0.rst doc/source/whatsnew/v0.13.1.rst doc/source/whatsnew/v0.15.0.rst From 2e6414e1802a7fb0024ff655129cadc16cb636ec Mon Sep 17 00:00:00 2001 From: Saurav Chakravorty Date: Sun, 16 Dec 2018 21:26:51 +0530 Subject: [PATCH 2/2] DOC: some more changes. --- doc/source/whatsnew/v0.12.0.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/source/whatsnew/v0.12.0.rst b/doc/source/whatsnew/v0.12.0.rst index 6448ebc70cdeb..4413fc5cec2a9 100644 --- a/doc/source/whatsnew/v0.12.0.rst +++ b/doc/source/whatsnew/v0.12.0.rst @@ -194,7 +194,7 @@ I/O Enhancements .. ipython :: python :okwarning: - df = DataFrame({'a': range(3), 'b': list('abc')}) + df = pd.DataFrame({'a': range(3), 'b': list('abc')}) print(df) html = df.to_html() alist = pd.read_html(html, index_col=0) @@ -298,7 +298,7 @@ Other Enhancements .. ipython :: python - df = DataFrame({'a': list('ab..'), 'b': [1, 2, 3, 4]}) + df = pd.DataFrame({'a': list('ab..'), 'b': [1, 2, 3, 4]}) df.replace(regex=r'\s*\.\s*', value=np.nan) to replace all occurrences of the string ``'.'`` with zero or more @@ -398,8 +398,8 @@ Experimental Features bday_egypt = CustomBusinessDay(holidays=holidays, weekmask=weekmask_egypt) dt = datetime(2013, 4, 30) print(dt + 2 * bday_egypt) - dts = date_range(dt, periods=5, freq=bday_egypt) - print(Series(dts.weekday, dts).map(Series('Mon Tue Wed Thu Fri Sat Sun'.split()))) + dts = pd.date_range(dt, periods=5, freq=bday_egypt) + print(pd.Series(dts.weekday, dts).map(pd.Series('Mon Tue Wed Thu Fri Sat Sun'.split()))) Bug Fixes ~~~~~~~~~