What’s New in 0.24.0 (January XX, 2019)¶
Warning
The 0.24.x series of releases will be the last to support Python 2. Future feature releases will support Python 3 only. See Plan for dropping Python 2.7 for more.
These are the changes in pandas 0.24.0. See Release Notes for a full changelog including other versions of pandas.
New features¶
merge()now directly allows merge between objects of typeDataFrameand namedSeries, without the need to convert theSeriesobject into aDataFramebeforehand (GH21220)ExcelWriternow acceptsmodeas a keyword argument, enabling append to existing workbooks when using theopenpyxlengine (GH3441)FrozenListhas gained the.union()and.difference()methods. This functionality greatly simplifies groupby’s that rely on explicitly excluding certain columns. See Splitting an object into groups for more information (GH15475, GH15506).DataFrame.to_parquet()now acceptsindexas an argument, allowing the user to override the engine’s default behavior to include or omit the dataframe’s indexes from the resulting Parquet file. (GH20768)DataFrame.corr()andSeries.corr()now accept a callable for generic calculation methods of correlation, e.g. histogram intersection (GH22684)DataFrame.to_string()now acceptsdecimalas an argument, allowing the user to specify which decimal separator should be used in the output. (GH23614)read_feather()now acceptscolumnsas an argument, allowing the user to specify which columns should be read. (GH24025)DataFrame.to_html()now acceptsrender_linksas an argument, allowing the user to generate HTML with links to any URLs that appear in the DataFrame. See the section on writing HTML in the IO docs for example usage. (GH2679)pandas.read_csv()now supports pandas extension types as an argument todtype, allowing the user to use pandas extension types when reading CSVs. (GH23228)DataFrame.shift()Series.shift(),ExtensionArray.shift(),SparseArray.shift(),Period.shift(),GroupBy.shift(),Categorical.shift(),NDFrame.shift()andBlock.shift()now accept fill_value as an argument, allowing the user to specify a value which will be used instead of NA/NaT in the empty periods. (GH15486)
Accessing the values in a Series or Index¶
Series.array and Index.array have been added for extracting the array backing a
Series or Index. (GH19954, GH23623)
In [1]: idx = pd.period_range('2000', periods=4)
In [2]: idx.array
Out[2]:
<PeriodArray>
['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04']
Length: 4, dtype: period[D]
In [3]: pd.Series(idx).array