-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
DOC: Updated the DataFrame.assign docstring #21917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit
Hold shift + click to select a range
58942fc
Working on the assign docstring
datapythonista de61b38
DOC: cont'd simplified examples in DataFrame.assign docstring
aeltanawy ef49f88
DOC: adjusted docstring examples in DataFrame.assign to illustrate py…
aeltanawy 1fa9bc5
DOC: Adjusted DataFrame.assign docstring
aeltanawy 4cb55a4
DOC: adjusted the grammer in DataFrame.assign docstring.
aeltanawy 7c7bb7a
Fixed loffset with numpy timedelta (#22482)
discort d96a334
CLN: Rename 'n' to 'repeats' in .repeat methods (#22574)
gfyoung 607d646
DOC: Updating DataFrame.merge docstring (#22141)
elmq0022 1b11063
TST: Add capture_stderr decorator to test_validate_docstrings (#22543)
WillAyd 3141dfe
BLD: Fix openpyxl to 2.5.5 (#22601)
gfyoung 66d376d
Use dispatch_to_series where possible (#22572)
jbrockmendel 2168e4a
BUG: resample with TimedeltaIndex, fenceposts are off (#22488)
discort 6693d9a
DOC: Update link and description of the Spyder IDE in Ecosystem docs …
CAM-Gerlach 4ed3760
DOC: Improve the docstring of DataFrame.equals() (#22539)
seantchan 25030e2
TST: fixturize series/test_alter_axes.py (#22526)
h-vetinari bdca5e9
TST: restructure internal extension arrays tests (split between /arra…
jorisvandenbossche 6c7c975
TST: Fix skipping test due to lack of connectivity (#22598)
rhysparry 2d21d9b
API: Add CalendarDay ('CD') offset (#22288)
mroeschke 9b92446
CLN/DEPR: removed deprecated as_indexer arg from str.match() (#22626)
HyunTruth ec1f7eb
BUG: NaN should have pct rank of NaN (#22600)
gfyoung 1bfe0c4
Set hypothesis healthcheck (#22597)
alimcmaster1 0ac130d
Implement delegate_names to allow decorating delegated attributes (#2…
jbrockmendel 1faac78
[PERF] use numexpr in dispatch_to_series (#22284)
jbrockmendel 24501d9
Fix incorrect DTI/TDI indexing; warn before dropping tzinfo (#22549)
jbrockmendel 52b1bf5
[CLN] More cython cleanups, with bonus type annotations (#22283)
jbrockmendel 2e21bd0
move rename functionality out of internals (#21924)
jbrockmendel 1a2b524
TST: Continue collecting arithmetic tests (#22559)
jbrockmendel 09a3d6b
BUG: fix failing DataFrame.loc when indexing with an IntervalIndex (#…
sideeye 128cbd9
DOC: Update `month_name` and `day_name` docstrings (#22544)
Peque f2af1c6
CLN: tests for str.cat (#22575)
h-vetinari 338683e
DOC: Fix to_latex docstring. (#22516)
Moisan 2fda626
TST: add test to io/formats/test_to_html.py to close GH6131 (#22588)
simonjayhawkins 49b560e
DOC/CLN: small whatsnew fixes (#22659)
jschendel 688c8a4
DOC: Add cross references to advanced.rst (#22671)
topper-123 f3b3694
DOC: Add section on MultiIndex.to_frame() ordering (#22674)
matthewgilbert 6b3e3c2
TST: Avoid DeprecationWarnings (#22646)
jbrockmendel 16725cf
TST: Collect/Use arithmetic test fixtures (#22645)
jbrockmendel 2ec957b
pythonize cython code (#22638)
jbrockmendel 9837dbc
API: register_extension_dtype class decorator (#22666)
TomAugspurger e371129
TST: Close ZipFile in compression test (#22679)
TomAugspurger 788158d
CLN: Standardize searchsorted signatures (#22670)
gfyoung 243a19e
DEPR: Removed styler shim (#22691)
TomAugspurger 3445e19
TST Use pytest.raises instead of legacy constructs (#22681)
rth 7d6f275
Fix test_sql pytest fixture warnings (#22515)
alimcmaster1 b151427
API: Add 'name' as argument for index 'to_frame' method (#22580)
henriqueribeiro dad9b7c
BUG: Incorrect addition of Week(weekday=6) to DatetimeIndex (#22695)
reidy-p fab723c
ASV: more for str.cat (#22652)
h-vetinari 1761dbc
TST: Test for bug fixed during #22534 discussion (#22694)
jbrockmendel 93628c5
Fix broken link in install.rst (#22716)
ratijas d950096
BUG: Make sure that sas7bdat parsers memory is initialized to 0 (#216…
troels 831a527
API: Make .shift always copy (Fixes #22397) (#22517)
AaronCritchley 2b81853
TST: Add test of DataFrame.xs() with duplicates (#13719) (#22294)
nmusolino e5d334f
DEPR: Standardize searchsorted signature (#22672)
gfyoung 2ac80c4
TST/CLN: break up & parametrize tests for df.set_index (#22236)
h-vetinari a507946
TST: Mock clipboard IO (#22715)
TomAugspurger 9fe3faf
removing superfluous reference to axis in Series.reorder_levels docst…
SandrineP 7afa8a0
CLN/DOC: Refactor timeseries.rst intro and overview (#22728)
mroeschke 006c013
CLN: Remove unused imports in pyx files (#22739)
mroeschke 845b21a
CLN: Removes module pandas.json (#22737)
vitoriahmc 3ec461f
TST/CLN: remove duplicate data file used in tests (unicode_series.csv…
simonjayhawkins 9465a59
BUG: Some sas7bdat files with many columns are not parseable by read_…
troels bbf119d
DOC: improve doc string for .aggregate and .transform (#22641)
topper-123 48de0db
BUG: DataFrame.apply not adding a frequency if freq=None (#22150) (#2…
HannahFerch 3c6ad7d
[ENH] pull in warning for dialect change from pandas-gbq. (#22557)
tswast 4310671
DOC: Updating str_repeat docstring (#22571)
JesperDramsch 49f7fc7
use fused types for reshape (#22454)
jbrockmendel c15d8c0
use fused types for parts of algos_common_helper (#22452)
jbrockmendel d03ef77
DOC: Updating the docstring of Series.str.extractall (#22565)
lucadonini96 52a480d
BUG: don't mangle NaN-float-values and pd.NaT (GH 22295) (#22296)
realead 9935305
DOC: Expose ExcelWriter as part of the Generated API (#22359)
newinh bada277
Test in scripts/validate_docstrings.py that the short summary is alwa…
Moisan 4f000f5
fix raise of TypeError when subtracting timedelta array (#22054)
illegalnumbers 79b8763
Bug: Logical operator of Series with Index (#22092) (#22293)
makbigc 1aaefe5
DOC: Fix Series nsmallest and nlargest docstring/doctests (#22731)
Moisan 9fe0fbc
Fixturize tests/frame/test_api and tests/sparse/frame/test_frame (#22…
h-vetinari d64c0a8
BUG SeriesGroupBy.mean() overflowed on some integer array (#22653)
troels 0ba7b16
TST: Fail on warning (#22699)
TomAugspurger 73ff71e
BUG: Allow IOErrors when attempting to retrieve default client encodi…
JayOfferdahl b7d9884
API: Git version (#22745)
alimcmaster1 22b2e4a
DOC: add more links to the API in advanced.rst (#22746)
topper-123 27ea656
DOC: Fix DataFrame.to_xarray doctests and allow the CI to run it. (#2…
Moisan 4a2a24c
Set up CI with Azure Pipelines (#22760)
azure-pipelines[bot] 96b7d84
CI: Fix travis CI (#22765)
TomAugspurger 113ff50
CI: Publish test summary (#22770)
TomAugspurger 5474d32
BUG: Check types in Index.__contains__ (#22085) (#22602)
yeojin-dev 6c765d3
Merge remote-tracking branch 'upstream/master' into doc
aeltanawy 61e4dee
Merge remote-tracking branch 'upstream/master' into doc
aeltanawy ecfaf47
Removing -assign from pandas/ci/doctests.sh
aeltanawy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
DOC: Adjusted DataFrame.assign docstring
- Loading branch information
commit 1fa9bc5983808d6d62a4625a49af7c8ee1f0079d
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3220,7 +3220,7 @@ def assign(self, **kwargs): | |
|
||
Parameters | ||
---------- | ||
kwargs : keyword, value pairs | ||
**kwargs : dict of {str: callable or series} | ||
The column names are keywords. If the values are | ||
callable, they are computed on the DataFrame and | ||
assigned to the new columns. The callable must not | ||
|
@@ -3230,7 +3230,7 @@ def assign(self, **kwargs): | |
|
||
Returns | ||
------- | ||
df : DataFrame | ||
DataFrame | ||
A new DataFrame with the new columns in addition to | ||
all the existing columns. | ||
|
||
|
@@ -3250,8 +3250,9 @@ def assign(self, **kwargs): | |
|
||
Examples | ||
-------- | ||
>>> df = pd.DataFrame({'temp_c': (17.0, 25.0)}, | ||
index=['Portland', 'Berkeley']) | ||
>>> df = pd.DataFrame({'temp_c': [17.0, 25.0]}, | ||
... index=['Portland', 'Berkeley']) | ||
>>> df | ||
temp_c | ||
Portland 17.0 | ||
Berkeley 25.0 | ||
|
@@ -3264,8 +3265,7 @@ def assign(self, **kwargs): | |
|
||
Alternatively, the same behavior can be achieved by directly | ||
referencing an existing Series or list-like: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO |
||
>>> newcol = df['temp_c'] * 9 / 5 + 32 | ||
>>> df.assign(temp_f=newcol) | ||
>>> df.assign(temp_f=df['temp_c'] * 9 / 5 + 32) | ||
temp_c temp_f | ||
Portland 17.0 62.6 | ||
Berkeley 25.0 77.0 | ||
|
@@ -3274,7 +3274,7 @@ def assign(self, **kwargs): | |
where one of the columns depends on another one defined within the same | ||
assign: | ||
>>> df.assign(temp_f=lambda x: x['temp_c'] * 9 / 5 + 32, | ||
temp_k=lambda x: (x['temp_f'] + 459.67) * 5 / 9) | ||
... temp_k=lambda x: (x['temp_f'] + 459.67) * 5 / 9) | ||
temp_c temp_f temp_k | ||
Portland 17.0 62.6 290.15 | ||
Berkeley 25.0 77.0 298.15 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use
Series
(with capitalS
) please?