content
large_stringlengths
3
20.5k
url
large_stringlengths
54
193
branch
large_stringclasses
4 values
source
large_stringclasses
42 values
embeddings
listlengths
384
384
score
float64
-0.21
0.65
.. \_sparse: {{ header }} \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Sparse data structures \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* pandas provides data structures for efficiently storing sparse data. These are not necessarily sparse in the typical "mostly 0". Rather, you can view these objects as being "compres...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/sparse.rst
main
pandas
[ -0.07209879159927368, 0.004367179237306118, -0.058042995631694794, 0.022824754938483238, 0.02321712113916874, -0.137265145778656, 0.05192553997039795, -0.04962867125868797, 0.012475020252168179, -0.019505305215716362, 0.01864073984324932, 0.009881979785859585, -0.023987019434571266, -0.009...
0.052569
python dense = pd.DataFrame({"A": [1, 0, 0, 1]}) dtype = pd.SparseDtype(int, fill\_value=0) dense.astype(dtype) .. \_sparse.scipysparse: Interaction with \*scipy.sparse\* ------------------------------- Use :meth:`DataFrame.sparse.from\_spmatrix` to create a :class:`DataFrame` with sparse values from a sparse matrix. ....
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/sparse.rst
main
pandas
[ -0.016331747174263, -0.06428627669811249, -0.12967725098133087, -0.033897142857313156, 0.0280748400837183, -0.07097125053405762, 0.02365228533744812, -0.045499738305807114, -0.05687633901834488, -0.020560935139656067, 0.005210232455283403, -0.0067014796659350395, 0.010112043470144272, 0.02...
-0.016689
{{ header }} .. \_user\_guide: ========== User Guide ========== The User Guide covers all of pandas by topic area. Each of the subsections introduces a topic (such as "working with missing data"), and discusses how pandas approaches the problem, with many examples throughout. Users brand-new to pandas should start with...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/index.rst
main
pandas
[ -0.026804547756910324, 0.024976124987006187, -0.014432422816753387, -0.0037179600913077593, 0.08214961737394333, -0.05081053823232651, -0.015084309503436089, 0.02990030311048031, -0.0527949221432209, -0.044096119701862335, 0.05071869492530823, 0.04017151519656181, -0.02049422822892666, -0....
0.009435
.. \_scale: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Scaling to large datasets \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* pandas provides data structures for in-memory analytics, which makes using pandas to analyze datasets that are larger than memory somewhat tricky. Even datasets that are a sizable ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/scale.rst
main
pandas
[ 0.03325990214943886, -0.02132614515721798, -0.05054723471403122, 0.03235363960266113, 0.0400548055768013, -0.07950926572084427, -0.04420175775885582, 0.05412903055548668, -0.02524699829518795, 0.008011083118617535, 0.005409813951700926, 0.009439211338758469, -0.09039855748414993, -0.001791...
-0.012095
a Parquet file and repeating that for each file in a directory. As long as each chunk fits in memory, you can work with datasets that are much larger than memory. .. note:: Chunking works well when the operation you're performing requires zero or minimal coordination between chunks. For more complicated workflows, you'...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/scale.rst
main
pandas
[ -0.04931753873825073, 0.044341232627630234, 0.0039053040090948343, -0.08097599446773529, -0.031777024269104004, -0.06400274485349655, -0.007212428376078606, 0.04125307872891426, -0.015236317180097103, 0.0027956271078437567, 0.01890091598033905, 0.052569251507520676, -0.0431206189095974, -0...
0.006845
.. currentmodule:: pandas .. ipython:: python :suppress: import pandas as pd import numpy as np .. \_boolean: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Nullable Boolean data type \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* .. note:: BooleanArray is currently experimental. Its API or implementation m...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/boolean.rst
main
pandas
[ -0.02583487331867218, 0.03720274940133095, -0.05025023594498634, 0.010930567048490047, 0.06434580683708191, -0.04624079540371895, 0.06582067906856537, -0.10598616302013397, -0.012482990510761738, 0.06331905722618103, 0.046005409210920334, -0.04300147667527199, 0.009880896657705307, 0.01608...
0.095922
.. \_reshaping: {{ header }} \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Reshaping and pivot tables \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* .. \_reshaping.reshaping: pandas provides methods for manipulating a :class:`Series` and :class:`DataFrame` to alter the representation of the data for furthe...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/reshaping.rst
main
pandas
[ -0.06029342859983444, -0.0534810945391655, -0.0505441315472126, -0.04078923165798187, -0.0005576504045166075, -0.04411141201853752, -0.0721435472369194, -0.014060508459806442, -0.02568344585597515, 0.048164140433073044, 0.013211175799369812, 0.0001332706306129694, -0.01173435989767313, -0....
-0.080289
you can use :class:`Grouper` for ``index`` and ``columns`` keywords. For detail of :class:`Grouper`, see :ref:`Grouping with a Grouper specification `. .. ipython:: python pd.pivot\_table(df, values="D", index=pd.Grouper(freq="ME", key="F"), columns="C") .. \_reshaping.pivot.margins: Adding margins ^^^^^^^^^^^^^^ Passi...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/reshaping.rst
main
pandas
[ -0.004489102866500616, -0.03737538307905197, -0.04456833377480507, 0.008098004385828972, -0.014664246700704098, 0.05356371030211449, -0.03726207837462425, -0.017366424202919006, -0.032748330384492874, 0.048603836447000504, 0.050852809101343155, 0.0038521005772054195, -0.0008091803756542504, ...
-0.118702
will be replaced with the default fill value for that data type. .. ipython:: python columns = pd.MultiIndex.from\_tuples( [ ("A", "cat"), ("B", "dog"), ("B", "cat"), ("A", "dog"), ], names=["exp", "animal"], ) index = pd.MultiIndex.from\_product( [("bar", "baz", "foo", "qux"), ("one", "two")], names=["first", "second"...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/reshaping.rst
main
pandas
[ -0.015538910403847694, -0.05149941146373749, 0.010470274835824966, -0.006173023954033852, -0.0011081668781116605, -0.0072739338502287865, 0.07416202127933502, -0.05987366661429405, 0.012791604734957218, -0.0009634859161451459, 0.06125742569565773, -0.03247033432126045, -0.03360075503587723, ...
-0.022615
= pd.get\_dummies(df, prefix=["from\_A", "from\_B"]) from\_list from\_dict = pd.get\_dummies(df, prefix={"B": "from\_B", "A": "from\_A"}) from\_dict To avoid collinearity when feeding the result to statistical models, specify ``drop\_first=True``. .. ipython:: python s = pd.Series(list("abcaa")) pd.get\_dummies(s) pd.g...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/reshaping.rst
main
pandas
[ -0.056365106254816055, -0.03137262910604477, 0.04335850477218628, 0.00882255844771862, -0.005463003646582365, -0.004554656334221363, 0.045366525650024414, -0.05740286782383919, 0.035714976489543915, 0.012052572332322598, 0.07870344817638397, -0.03408763185143471, -0.04577447474002838, -0.0...
-0.093996
within each group defined by the first two :class:`Series`: .. ipython:: python pd.crosstab(df["A"], df["B"], values=df["C"], aggfunc="sum") Adding margins ~~~~~~~~~~~~~~ ``margins=True`` will add a row and column with an ``All`` label with partial group aggregates across the categories on the rows and columns: .. ipyt...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/reshaping.rst
main
pandas
[ -0.006187598221004009, -0.017105408012866974, -0.06013777479529381, -0.0046959538012743, 0.007086524739861488, 0.032450366765260696, -0.028391050174832344, -0.07731103152036667, -0.036767374724149704, 0.012071298435330391, 0.008342496119439602, -0.0796678438782692, -0.1169445812702179, -0....
0.000396
.. \_udf: {{ header }} \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* User-Defined Functions (UDFs) \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* In pandas, User-Defined Functions (UDFs) provide a way to extend the library’s functionality by allowing users to apply custom computations to their ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/user_defined_functions.rst
main
pandas
[ -0.05228685215115547, -0.06243884935975075, -0.022534089162945747, -0.03797866031527519, 0.031372468918561935, -0.08490683138370514, -0.010105138644576073, -0.012231369502842426, 0.017427047714591026, 0.06462249904870987, 0.02175070531666279, -0.01666465401649475, -0.0686565563082695, -0.0...
0.11697
and is designed for different use cases. Understanding the purpose and behavior of each method will help you make informed decisions, ensuring more efficient and maintainable code. .. note:: Some of these methods are can also be applied to groupby, resample, and various window objects. See :ref:`groupby`, :ref:`resampl...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/user_defined_functions.rst
main
pandas
[ -0.0193172637373209, -0.023311307653784752, -0.06072762981057167, -0.01476184744387865, 0.07866911590099335, -0.09184962511062622, -0.05418643727898598, 0.02530866488814354, -0.027499696239829063, 0.03887922316789627, 0.051924847066402435, -0.018833477050065994, -0.024434993043541908, -0.0...
0.143301
``pipe`` method is similar to ``map`` and ``apply``, but the function receives the whole ``Series`` or ``DataFrame`` it is called on. .. ipython:: python temperature = pd.DataFrame({ "NYC": [14, 21, 23], "Los Angeles": [22, 28, 31], }) def normalize(df): return df / df.mean().mean() temperature.pipe(normalize) This is ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/user_defined_functions.rst
main
pandas
[ 0.0467853881418705, -0.015022926032543182, 0.023895064368844032, 0.004494645167142153, -0.02684742957353592, -0.09613490849733353, -0.04485376551747322, 0.03315955027937889, -0.036305882036685944, -0.0008434327319264412, 0.026879161596298218, 0.006674232427030802, -0.04983201250433922, 0.0...
0.086402
5.6435 secs Vectorized: 0.0043 secs Vectorized operations in pandas are significantly faster than using :meth:`DataFrame.apply` with UDFs because they leverage highly optimized C functions via ``NumPy`` to process entire arrays at once. This approach avoids the overhead of looping through rows in Python and making sepa...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/user_defined_functions.rst
main
pandas
[ -0.020448217168450356, -0.060897305607795715, -0.03390787914395332, -0.019269578158855438, 0.056288864463567734, -0.17762471735477448, -0.07235367596149445, 0.005525065120309591, -0.026884375140070915, 0.03585362434387207, -0.03365650773048401, 0.023563535884022713, -0.08626285940408707, -...
0.044535
.. \_io: .. currentmodule:: pandas =============================== IO tools (text, CSV, HDF5, ...) =============================== The pandas I/O API is a set of top level ``reader`` functions accessed like :func:`pandas.read\_csv` that generally return a pandas object. The corresponding ``writer`` functions are object...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.04403560608625412, -0.017171217128634453, -0.08755877614021301, 0.08910945057868958, 0.04141391068696976, -0.13506555557250977, 0.022129913792014122, 0.046665605157613754, 0.04592479020357132, 0.04116169363260269, -0.008359591476619244, -0.014859418384730816, -0.026929721236228943, -0.0...
0.112777
or False, optional, default ``None`` Column(s) to use as the row labels of the ``DataFrame``, either given as string name or column index. If a sequence of int / str is given, a MultiIndex is used. .. note:: ``index\_col=False`` can be used to force pandas to \*not\* use the first column as the index, e.g. when you hav...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.012832367792725563, 0.0009341102559119463, -0.06098533794283867, -0.011752907186746597, 0.07327930629253387, -0.06600821763277054, 0.008847573772072792, -0.027834517881274223, 0.043224141001701355, 0.02323063649237156, 0.06938078254461288, 0.04569707810878754, -0.05242284759879112, -0.0...
0.018834
supported by the pyarrow engine. Some features of the "pyarrow" engine are unsupported or may not work correctly. converters : dict, default ``None`` Dict of functions for converting values in certain columns. Keys can either be integers or column labels. true\_values : list, default ``None`` Values to consider as ``Tr...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.027633465826511383, 0.03614453226327896, -0.08330228179693222, -0.02346443571150303, -0.03605232387781143, -0.052344512194395065, 0.007252772804349661, -0.011257415637373924, -0.02839759923517704, 0.012746889144182205, 0.030593231320381165, 0.06316805630922318, -0.00813913345336914, -0....
-0.082832
a separate date column. .. note:: A fast-path exists for iso8601-formatted dates. date\_format : str or dict of column -> format, default ``None`` If used in conjunction with ``parse\_dates``, will parse dates according to this format. For anything more complex, please read in as ``object`` and then apply :func:`to\_da...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.004795904271304607, 0.03208966925740242, -0.03175137937068939, 0.04329368844628334, -0.027056731283664703, -0.06564092636108398, -0.03939400240778923, 0.037077538669109344, -0.04505816474556923, -0.00017834253958426416, 0.0368335098028183, -0.10221778601408005, -0.09759163111448288, -0....
0.034648
``delimiter``, ``doublequote``, ``escapechar``, ``skipinitialspace``, ``quotechar``, and ``quoting``. If it is necessary to override values, a ParserWarning will be issued. See :class:`python:csv.Dialect` documentation for more details. Error handling ++++++++++++++ on\_bad\_lines : {{'error', 'warn', 'skip'}}, default...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.10278447717428207, 0.058759596198797226, 0.005018250551074743, 0.04354051873087883, -0.053241558372974396, -0.08821550756692886, -0.007735834922641516, 0.027811862528324127, -0.048053842037916183, 0.018072156235575676, -0.024780485779047012, -0.0640217587351799, 0.07400082051753998, -0....
0.04472
more control on the categories and order, create a :class:`~pandas.api.types.CategoricalDtype` ahead of time, and pass that for that column's ``dtype``. .. ipython:: python from pandas.api.types import CategoricalDtype dtype = CategoricalDtype(["d", "c", "b", "a"], ordered=True) pd.read\_csv(StringIO(data), dtype={"col...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ 0.015863779932260513, -0.0016782901948317885, 0.02570728212594986, 0.007103785406798124, -0.031241046264767647, -0.04550982266664505, -0.045684270560741425, -0.0035239150747656822, 0.02348283864557743, -0.015394845977425575, 0.02906177192926407, -0.0028366444166749716, -0.05652354657649994, ...
-0.009083
lines might create ambiguities involving line numbers; the parameter ``header`` uses row numbers (ignoring commented/empty lines), while ``skiprows`` uses line numbers (including commented/empty lines): .. ipython:: python data = "#comment\na,b,c\nA,B,C\n1,2,3" pd.read\_csv(StringIO(data), comment="#", header=1) data =...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.06021047383546829, 0.043118808418512344, 0.015405109152197838, 0.015600504353642464, -0.027208037674427032, -0.028067655861377716, 0.02788148634135723, 0.011514163576066494, 0.008314265869557858, 0.007951735518872738, 0.038631655275821686, -0.020172670483589172, 0.07188968360424042, -0....
0.043793
fast\_path for parsing datetime strings in iso8601 format, e.g "2000-01-01T00:01:02+00:00" and similar variations. If you can arrange for your data to store datetimes in this format, load times will be significantly faster, ~20x has been observed. Date parsing functions ++++++++++++++++++++++ Finally, the parser allows...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ 0.039548661559820175, -0.026360560208559036, -0.004088388290256262, 0.06307225674390793, -0.05062190443277359, -0.04222702607512474, -0.0546410009264946, 0.06078118830919266, -0.021642468869686127, -0.006436470430344343, -0.0009634526213631034, -0.00009118007437791675, -0.09658419340848923, ...
0.002905
are the ordinary converter, the high-precision converter, and the round-trip converter (which is guaranteed to round-trip values after writing to a file). For example: .. ipython:: python val = "0.3066101993807095471566981359501369297504425048828125" data = "a,b,c\n1,2,{0}".format(val) abs( pd.read\_csv( StringIO(data)...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.03293817862868309, 0.04130459949374199, -0.09297258406877518, -0.005704045295715332, -0.01938406005501747, -0.10098657757043839, -0.04769875854253769, 0.07677462697029114, 0.019266292452812195, -0.03075927495956421, 0.021006986498832703, -0.08539418131113052, -0.055556654930114746, -0.0...
0.043925
return line[-3:] pd.read\_csv(StringIO(data), on\_bad\_lines=bad\_lines\_func, engine="python") external\_list .. note:: The callable function will handle only a line with too many fields. Bad lines caused by other errors will be silently skipped. .. ipython:: python bad\_lines\_func = lambda line: print(line) data = '...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.06190820410847664, 0.051534056663513184, -0.00559961935505271, 0.05355839803814888, -0.023667016997933388, -0.09313909709453583, 0.06110464036464691, 0.08473500609397888, -0.0382344126701355, -0.025590553879737854, 0.030217140913009644, -0.034831032156944275, -0.012417962774634361, -0.0...
0.016887
the filler character of the fields if it is not spaces (e.g., '~'). Consider a typical fixed-width data file: .. ipython:: python data1 = ( "id8141 360.242940 149.910199 11950.7\n" "id1594 444.953632 166.985655 11788.4\n" "id1849 364.136849 183.628767 11806.2\n" "id1230 413.836124 184.375703 11916.8\n" "id1948 502.9539...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.018076522275805473, 0.03328443691134453, -0.0017204552423208952, 0.02630568854510784, 0.014460217207670212, -0.07806666940450668, -0.004065840505063534, 0.07357654720544815, -0.00873896386474371, -0.0013006911613047123, -0.05550498142838478, 0.032128237187862396, -0.03230712190270424, -...
-0.009728
will be \*lost\*. .. ipython:: python :suppress: os.remove("mi.csv") os.remove("mi2.csv") .. \_io.sniff: Automatically "sniffing" the delimiter '''''''''''''''''''''''''''''''''''''' ``read\_csv`` is capable of inferring delimited (not necessarily comma-separated) files, as pandas uses the :class:`python:csv.Sniffer` c...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.01393665000796318, 0.010041240602731705, 0.032708778977394104, 0.014915889129042625, 0.10765723884105682, -0.09535826742649078, 0.07070133090019226, -0.06860911846160889, 0.05017988011240959, -0.014559444971382618, 0.016493994742631912, 0.01382382120937109, -0.03362758457660675, -0.0248...
-0.0388
in special locations. For example, to access data in your S3 bucket, you will need to define credentials in one of the several ways listed in the `S3Fs documentation `\_. The same is true for several of the storage backends, and you should follow the links at `fsimpl1`\_ for implementations built into ``fsspec`` and `f...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.009684347547590733, -0.02545124478638172, -0.1304435282945633, 0.010231925174593925, 0.020739659667015076, -0.05012084171175957, -0.029289737343788147, 0.039271704852581024, 0.058106716722249985, 0.018779171630740166, -0.04266991838812828, -0.05284133926033974, 0.028887005522847176, -0....
-0.052034
All arguments are optional: \* ``buf`` default None, for example a StringIO object \* ``columns`` default None, which columns to write \* ``col\_space`` default None, minimum width of each column. \* ``na\_rep`` default ``NaN``, representation of NA value \* ``formatters`` default None, a dictionary (by column) of func...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.002277413150295615, -0.01835000142455101, -0.13284215331077576, 0.019406801089644432, -0.007102512288838625, -0.06911468505859375, 0.032140713185071945, -0.0060297041200101376, -0.01284675020724535, 0.005530230700969696, 0.06506351381540298, -0.08254791051149368, -0.010633018799126148, ...
0.119632
y=16, z=17), name="D") sjo \*\*Column oriented\*\* (the default for ``DataFrame``) serializes the data as nested JSON objects with column labels acting as the primary index: .. ipython:: python dfjo.to\_json(orient="columns") # Not available for Series \*\*Index oriented\*\* (the default for ``Series``) similar to colu...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.03628649190068245, -0.011007171124219894, -0.04965002089738846, -0.022903162986040115, 0.011890486814081669, -0.021579716354608536, -0.03046380914747715, 0.009496637620031834, -0.02044975943863392, -0.02829091064631939, 0.029279135167598724, 0.05618157237768173, -0.0751345083117485, 0.0...
0.059173
or frame), default 'frame' \* ``orient`` : Series : \* default is ``index`` \* allowed values are {``split``, ``records``, ``index``} DataFrame \* default is ``columns`` \* allowed values are {``split``, ``records``, ``index``, ``columns``, ``values``, ``table``} The format of the JSON string .. csv-table:: :widths: 20...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ 0.00009528411464998499, 0.05678442865610123, -0.0563102625310421, -0.006048308219760656, -0.006406036205589771, -0.030742643401026726, 0.012767661362886429, 0.02104811742901802, -0.006224384531378746, 0.01718277670443058, 0.05202537775039673, 0.020135847851634026, -0.01689213700592518, 0.0...
-0.014266
\* bool columns will be converted to ``integer`` on reconstruction Thus there are times where you may want to specify specific dtypes via the ``dtype`` keyword argument. Reading from a JSON string: .. ipython:: python from io import StringIO pd.read\_json(StringIO(json)) Reading from a file: .. ipython:: python pd.read...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.00993956346064806, 0.006235884036868811, -0.045674555003643036, 0.00883210264146328, 0.015151454135775566, -0.07019072026014328, 0.003501752158626914, 0.018790479749441147, -0.03264758735895157, -0.008087669499218464, 0.025472817942500114, -0.02374095655977726, -0.07437480986118317, 0.0...
0.126232
and ``data``. .. ipython:: python df = pd.DataFrame( { "A": [1, 2, 3], "B": ["a", "b", "c"], "C": pd.date\_range("2016-01-01", freq="D", periods=3), }, index=pd.Index(range(3), name="idx"), ) df df.to\_json(orient="table", date\_format="iso") The ``schema`` field contains the ``fields`` key, which itself contains a lis...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.006018581334501505, 0.023916080594062805, 0.016260778531432152, 0.010197105817496777, 0.005259782541543245, 0.02646312303841114, -0.04109320417046547, 0.013753301464021206, 0.031494464725255966, -0.020782848820090294, 0.05303936079144478, 0.033996593207120895, -0.07504826784133911, -0.0...
0.098699
.. ipython:: python :okwarning: df.index.name = "index" df.to\_json("test.json", orient="table") new\_df = pd.read\_json("test.json", orient="table") print(new\_df.index.name) .. ipython:: python :suppress: os.remove("test.json") When using ``orient='table'`` along with user-defined ``ExtensionArray``, the generated sc...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.009724840521812439, 0.010552694089710712, -0.04096106439828873, 0.03776666894555092, 0.038691237568855286, -0.06531500071287155, 0.005451845470815897, 0.022294655442237854, -0.01847536861896515, -0.01097491942346096, 0.09940551221370697, 0.04429475963115692, -0.08290636539459229, 0.0436...
0.068235
`` `` elements located within a ```` are used to form the column index, if multiple rows are contained within ```` then a MultiIndex is created); if specified, the header row is taken from the data minus the parsed header elements (`` `` elements). .. code-block:: python dfs = pd.read\_html(url, header=0) Specify an in...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.03504197672009468, -0.017316671088337898, -0.033825233578681946, -0.006265178322792053, 0.08073946088552475, -0.10191913694143295, -0.05194409564137459, -0.04362068697810173, -0.01766669750213623, 0.05740714445710182, 0.05030270665884018, 0.0243410374969244, 0.022901484742760658, -0.091...
-0.027104
values: .. ipython:: python html = df.to\_html(float\_format="{0:.10f}".format) print(html) display(HTML(html)) ``bold\_rows`` will make the row labels bold by default, but you can turn that off: .. ipython:: python html = df.to\_html(bold\_rows=False) print(html) display(HTML(html)) The ``classes`` argument provides t...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.011970064602792263, -0.02799207717180252, -0.06330300867557526, 0.036180879920721054, 0.06508034467697144, -0.0397675558924675, 0.015618560835719109, -0.06313777714967728, -0.03849279135465622, 0.02301771752536297, 0.006125193554908037, 0.038492728024721146, -0.0077477735467255116, -0.0...
-0.055604
LaTeX files '''''''''''''''''''''' .. note:: DataFrame \*and\* Styler objects currently have a ``to\_latex`` method. We recommend using the `Styler.to\_latex() <../reference/api/pandas.io.formats.style.Styler.to\_latex.rst>`\_\_ method over `DataFrame.to\_latex() <../reference/api/pandas.DataFrame.to\_latex.rst>`\_\_ d...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.04205647483468056, 0.010305006988346577, -0.03816142678260803, -0.03256932646036148, 0.05384224280714989, -0.030947919934988022, -0.006948292721062899, 0.03240076079964638, 0.01178895216435194, 0.05552210286259651, 0.030486593022942543, 0.06247913837432861, -0.024912459775805473, 0.0239...
-0.000323
python xml = """xml version='1.0' encoding='utf-8'? square 360 4.0 circle 360 triangle 180 3.0 """ df = pd.read\_xml(StringIO(xml), xpath="//pandas:row", namespaces={"pandas": "https://example.com"}) df However, if XPath does not reference node names such as default, ``/\*``, then ``namespaces`` is not required. .. not...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ 0.004144830163568258, 0.001994598424062133, -0.020500048995018005, 0.009674035012722015, 0.019458480179309845, -0.11156729608774185, -0.04091252014040947, -0.02766844816505909, 0.009596510790288448, -0.03221922740340233, 0.09120602905750275, -0.050467830151319504, 0.040873780846595764, -0....
-0.026886
... 3578760 Page:Black cat 1897 07 v2 n10.pdf/17 104 219649 3578761 Page:Black cat 1897 07 v2 n10.pdf/43 104 219649 3578762 Page:Black cat 1897 07 v2 n10.pdf/44 104 219649 3578763 The History of Tom Jones, a Foundling/Book IX 0 12084291 3578764 Page:Shakespeare of Stratford (1926) Yale.djvu/91 104 21450 [3578765 rows x...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.06462027132511139, -0.0190754272043705, -0.04939773678779602, 0.010629788972437382, 0.008228433318436146, -0.02574346400797367, -0.05973187834024429, -0.05349719896912575, -0.017699312418699265, 0.005881618708372116, 0.06768938899040222, 0.039138440042734146, 0.029441924765706062, -0.11...
0.054018
:func:`~pandas.read\_excel` method can read Excel 2007+ (``.xlsx``) files using the ``openpyxl`` Python module. Excel 2003 (``.xls``) files can be read using ``xlrd``. Binary Excel (``.xlsb``) files can be read using ``pyxlsb``. All formats can be read using :ref:`calamine` engine. The :meth:`~DataFrame.to\_excel` inst...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.04388437420129776, -0.01788480021059513, -0.13980509340763092, 0.01376244705170393, 0.03179580345749855, -0.04218009114265442, -0.09412094205617905, 0.09254700690507889, 0.07693183422088623, 0.01858483999967575, -0.0008036295766942203, 0.019591862335801125, -0.010821692645549774, -0.067...
0.006916
be confused with ``ExcelFile.sheet\_names``. .. note:: An ExcelFile's attribute ``sheet\_names`` provides access to a list of sheets. \* The arguments ``sheet\_name`` allows specifying the sheet or sheets to read. \* The default value for ``sheet\_name`` is 0, indicating to read the first sheet \* Pass a string to refe...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.049644459038972855, 0.062107332050800323, -0.08599227666854858, 0.015203980728983879, 0.00046928008669056, -0.026744093745946884, 0.048872947692871094, 0.03592422232031822, 0.05007612705230713, 0.009061220102012157, 0.03824600577354431, 0.026454418897628784, 0.020647654309868813, -0.069...
0.010352
assumed that each string corresponds to a column name provided either by the user in ``names`` or inferred from the document header row(s). Those strings define which columns will be parsed: .. code-block:: python pd.read\_excel("path\_to\_file.xls", "Sheet1", usecols=["foo", "bar"]) Element order is ignored, so ``usec...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.04669158533215523, 0.05545623600482941, -0.07851990312337875, 0.02834465727210045, -0.05080850049853325, -0.01401399914175272, -0.027102241292595863, 0.09370028227567673, 0.027317015454173088, -0.016119787469506264, 0.005241308361291885, -0.0033021492417901754, -0.028707146644592285, -0...
-0.074501
\* For the engine odf, pandas is using :func:`odf.opendocument.OpenDocumentSpreadsheet` to write to (``.ods``) files. Writing Excel files to memory +++++++++++++++++++++++++++++ pandas supports writing Excel files to buffer-like objects such as ``StringIO`` or ``BytesIO`` using :class:`~pandas.io.excel.ExcelWriter`. .....
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.028552038595080376, 0.0192409660667181, -0.07682264596223831, 0.01383669301867485, -0.017864800989627838, -0.06615718454122543, -0.06723874062299728, 0.08233237266540527, 0.03528059273958206, -0.007144653704017401, -0.014755459502339363, 0.0075229923240840435, -0.010924206115305424, -0....
-0.002573
engine="odf") Similarly, the :func:`~pandas.to\_excel` method can write OpenDocument spreadsheets .. code-block:: python # Writes DataFrame to a .ods file df.to\_excel("path\_to\_file.ods", engine="odf") .. \_io.xlsb: Binary Excel (.xlsb) files -------------------------- The :func:`~pandas.read\_excel` method can also ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.07596085220575333, -0.007371121551841497, -0.15496213734149933, 0.00018998626910615712, 0.03189626708626747, -0.09371530264616013, -0.10806100070476532, 0.07374831289052963, 0.0839509442448616, -0.022072937339544296, 0.010563531890511513, 0.028076447546482086, -0.05987843498587608, -0.0...
-0.026391
file to be read. The compression type can be an explicit parameter or be inferred from the file extension. If 'infer', then use ``gzip``, ``bz2``, ``zip``, ``xz``, ``zstd`` if filename ends in ``'.gz'``, ``'.bz2'``, ``'.zip'``, ``'.xz'``, or ``'.zst'``, respectively. The compression parameter can also be a ``dict`` in ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.07577424496412277, 0.08137395232915878, -0.07689853757619858, 0.01955169439315796, 0.02677423320710659, -0.056038156151771545, 0.018907269462943077, 0.05803157016634941, -0.028400979936122894, 0.031195344403386116, -0.026557682082057, 0.07764270901679993, -0.02644685097038746, 0.0562346...
-0.000592
os.remove("file.h5") .. \_io.hdf5-fixed: Fixed format '''''''''''' The examples above show storing using ``put``, which write the HDF5 to ``PyTables`` in a fixed array format, called the ``fixed`` format. These types of stores are \*\*not\*\* appendable once written (though you can simply remove them and rewrite). Nor ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.010871266946196556, -0.011626658961176872, -0.0815550684928894, 0.034261494874954224, 0.07850564271211624, -0.09525193274021149, 0.03339803218841553, -0.04274388775229454, -0.0172817874699831, 0.04223425313830376, 0.08297053724527359, 0.09604787826538086, -0.029016049578785896, -0.06491...
-0.030164
``nan\_rep = 'nan'`` to append will change the default nan representation on disk (which converts to/from ``np.nan``), this defaults to ``nan``. .. ipython:: python df\_mixed = pd.DataFrame( { "A": np.random.randn(8), "B": np.random.randn(8), "C": np.array(np.random.randn(8), dtype="float32"), "string": "string", "int"...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.006538511253893375, -0.0576808862388134, 0.02155548706650734, -0.0006990175461396575, 0.06423772871494293, -0.047830838710069656, 0.018689053133130074, -0.05896833911538124, 0.018781380727887154, 0.06851832568645477, 0.10287175327539444, -0.048867300152778625, -0.04563983157277107, -0.0...
-0.059061
``string`` variable. If you \*must\* interpolate, use the ``'%r'`` format specifier .. code-block:: python store.select("df", "index == %r" % string) which will quote ``string``. Here are some examples: .. ipython:: python dfq = pd.DataFrame( np.random.randn(10, 4), columns=list("ABCD"), index=pd.date\_range("20130101"...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.01983805000782013, 0.05128863826394081, -0.00693949731066823, 0.006858150474727154, -0.04253916069865227, 0.037951670587062836, 0.0339139960706234, 0.026709772646427155, -0.033153925091028214, 0.05361940711736679, 0.019036592915654182, -0.023592283949255943, -0.030425501987338066, -0.08...
-0.091093
`here `\_\_ for how to create a completely-sorted-index (CSI) on an existing store. .. \_io.hdf5-query-data-columns: Query via data columns ++++++++++++++++++++++ You can designate (and index) certain columns that you want to be able to perform queries (other than the ``indexable`` columns, which you can always query)....
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ 0.026700306683778763, -0.04869236424565315, -0.007941296324133873, 0.013650714419782162, 0.028425514698028564, -0.022065678611397743, 0.012228396721184254, -0.037356261163949966, -0.01928972825407982, 0.07401163130998611, 0.022995900362730026, 0.08006918430328369, -0.037163589149713516, -0...
-0.078675
datetimeindex which are 5. .. ipython:: python df\_mask = pd.DataFrame( np.random.randn(1000, 2), index=pd.date\_range("20000101", periods=1000) ) store.append("df\_mask", df\_mask) c = store.select\_column("df\_mask", "index") where = c[pd.DatetimeIndex(c).month == 5].index store.select("df\_mask", where=where) Storer...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ 0.06375972926616669, -0.03114963136613369, -0.05481602996587753, 0.06498117744922638, 0.032275691628456116, -0.0095664756372571, 0.03889892250299454, -0.059623513370752335, -0.016595596447587013, 0.06499408185482025, 0.047161877155303955, -0.06768453121185303, -0.04604431614279747, -0.0866...
-0.03309
selects all but the missing data. .. warning:: Please note that HDF5 \*\*DOES NOT RECLAIM SPACE\*\* in the h5 files automatically. Thus, repeatedly deleting (or removing nodes) and adding again, \*\*WILL TEND TO INCREASE THE FILE SIZE\*\*. To \*repack and clean\* the file, use :ref:`ptrepack `. .. \_io.hdf5-notes: Note...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.04125275835394859, 0.015148638747632504, -0.08864910900592804, 0.03012603521347046, 0.07039446383714676, -0.0677248015999794, -0.004447724670171738, 0.005725555121898651, -0.0711577832698822, 0.038297805935144424, 0.02479761280119419, 0.03948308899998665, -0.0031344471499323845, -0.0586...
0.051352
UTC since these timezones are not considered equal. Either use the same version of timezone library or use ``tz\_convert`` with the updated timezone definition. .. warning:: ``PyTables`` will show a ``NaturalNameWarning`` if a column name cannot be used as an attribute selector. \*Natural\* identifiers contain only let...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.012271774001419544, -0.03444395586848259, -0.031208153814077377, 0.00543277058750391, 0.04436389356851578, -0.04716531187295914, 0.008295050822198391, -0.007297836244106293, -0.07198279350996017, -0.0024268333800137043, -0.02628304250538349, -0.09849110245704651, -0.029327547177672386, ...
-0.010649
times can be quite fast, especially on an indexed axis. \* You can pass ``chunksize=`` to ``append``, specifying the write chunksize (default is 50000). This will significantly lower your memory usage on writing. \* You can pass ``expectedrows=`` to the first ``append``, to set the TOTAL number of rows that ``PyTables`...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ 0.0013402366312220693, -0.029584690928459167, -0.060630813241004944, 0.05720449239015579, 0.012517954222857952, -0.08859333395957947, 0.002318985527381301, -0.022006111219525337, -0.037432003766298294, 0.014337214641273022, 0.007121842820197344, 0.07533397525548935, -0.02434072643518448, -...
0.021544
such as the nullable integer and string data type (this can also work for external extension types, requiring the extension type to implement the needed protocols, see the :ref:`extension types documentation `). You can specify an ``engine`` to direct the serialization. This can be one of ``pyarrow``, or ``fastparquet`...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.040343690663576126, -0.005322354380041361, -0.09759572148323059, -0.08929383754730225, -0.08377371728420258, -0.07277139276266098, -0.03404722735285759, 0.08335526287555695, -0.050394631922245026, -0.06498696655035019, 0.06093066185712814, 0.04620042443275452, -0.0880308449268341, 0.005...
0.013385
look like: .. code-block:: text test ├── a=0 │ ├── 0bac803e32dc42ae83fddfd029cbdebc.parquet │ └── ... └── a=1 ├── e6ab24a4f45147b49b54a662f0c412a3.parquet └── ... .. ipython:: python :suppress: from shutil import rmtree try: rmtree("test") except OSError: pass .. \_io.iceberg: Iceberg ------- .. versionadded:: 3.0.0 Ap...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.03273948282003403, 0.013398741371929646, -0.0808277577161789, 0.010883647948503494, 0.08858881145715714, -0.11651479452848434, -0.0338180772960186, 0.05360203608870506, -0.005455471109598875, 0.028969639912247658, 0.046383876353502274, 0.0518222376704216, -0.027536116540431976, -0.07969...
0.027363
dependencies `. \* For supported dtypes please refer to `supported ORC features in Arrow `\_\_. \* Currently timezones in datetime columns are not preserved when a dataframe is converted into ORC files. .. ipython:: python df = pd.DataFrame( { "a": list("abc"), "b": list(range(1, 4)), "c": np.arange(4.0, 7.0, dtype="fl...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.02149292826652527, -0.07031871378421783, -0.016758257523179054, 0.009140203706920147, 0.08262816816568375, -0.019538365304470062, -0.010309654287993908, -0.01385407242923975, -0.04990105703473091, 0.011743874289095402, -0.00762316957116127, -0.0014858279610052705, -0.12039852142333984, ...
-0.037441
open a connection to a database you are also responsible for closing it. Side effects of leaving a connection open may include locking the database or other breaking behaviour. Writing DataFrames '''''''''''''''''' Assuming the following data is in a ``DataFrame`` ``data``, we can insert it into the database using :fun...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.010501628741621971, -0.06200943514704704, -0.07739456743001938, 0.10048943758010864, 0.0013291501672938466, -0.03357821702957153, -0.023735353723168373, -0.03855995833873749, -0.010586467571556568, 0.06526806950569153, 0.04844760522246361, 0.053485240787267685, -0.05254705995321274, -0....
-0.010623
argument needs a dictionary mapping column names to SQLAlchemy types (or strings for the sqlite3 fallback mode). For example, specifying to use the sqlalchemy ``String`` type instead of the default ``Text`` type for string columns: .. ipython:: python from sqlalchemy.types import String data.to\_sql("data\_dtype", con=...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ 0.02075943537056446, -0.0158720463514328, -0.10670062899589539, 0.027737174183130264, -0.1123519167304039, -0.07975374162197113, 0.044414423406124115, 0.010938117280602455, -0.048913948237895966, -0.04918684437870979, -0.022163785994052887, -0.056628864258527756, -0.03659740835428238, -0.0...
-0.00517
the table name and optionally a subset of columns to read. .. note:: In order to use :func:`~pandas.read\_sql\_table`, you \*\*must\*\* have the ADBC driver or SQLAlchemy optional dependency installed. .. ipython:: python pd.read\_sql\_table("data", engine) .. note:: ADBC drivers will map database types directly back t...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ 0.03740748018026352, -0.080037422478199, -0.09792237728834152, 0.06907879561185837, -0.08602017164230347, -0.10494191199541092, 0.10083135217428207, 0.04347723349928856, -0.03295540064573288, -0.03522685170173645, -0.025703946128487587, -0.0009669812861829996, -0.057298075407743454, -0.045...
-0.009149
sa.Integer), sa.Column("Date", sa.DateTime), sa.Column("Col\_1", sa.String), sa.Column("Col\_2", sa.Float), sa.Column("Col\_3", sa.Boolean), ) pd.read\_sql(sa.select(data\_table).where(data\_table.c.Col\_3 is True), engine) You can combine SQLAlchemy expressions with parameters passed to :func:`read\_sql` using :func:`...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.00577854597941041, -0.019542893394827843, -0.02684164233505726, 0.048079926520586014, -0.02006586454808712, -0.040746983140707016, 0.06328743696212769, 0.04467052221298218, -0.08303448557853699, 0.030413618311285973, -0.0004571695753838867, -0.04986315593123436, -0.02033902332186699, -0...
-0.087729
from them. Value labels can also be retrieved by the function ``value\_labels``, which requires :func:`~pandas.io.stata.StataReader.read` to be called before use. The parameter ``convert\_missing`` indicates whether missing value representations in Stata should be preserved. If ``False`` (the default), missing values a...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.043128639459609985, 0.009991980157792568, -0.16013994812965393, 0.016364233568310738, 0.05648117884993553, 0.016736174002289772, 0.029666736721992493, 0.022279875352978706, 0.0022580642253160477, -0.008640921674668789, 0.09514794498682022, -0.050498344004154205, -0.04350091516971588, -0...
0.053145
may allow date variables to be automatically converted to dates. By default the whole file is read and returned as a ``DataFrame``. Specify a ``chunksize`` or use ``iterator=True`` to obtain reader objects (``XportReader`` or ``SAS7BDATReader``) for incrementally reading the file. The reader objects also have attribute...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ -0.04833303391933441, -0.03527246043086052, -0.08759982883930206, 0.02103767916560173, -0.008014137856662273, -0.02811691351234913, 0.013472391292452812, 0.039712078869342804, -0.07585492730140686, 0.08075764775276184, -0.0022762513253837824, 0.05964650586247444, -0.008892805315554142, -0....
-0.069134
in terms of speed are ``test\_feather\_write``, ``test\_hdf\_fixed\_write`` and ``test\_hdf\_fixed\_write\_compress``. .. code-block:: ipython In [4]: %timeit test\_sql\_write(df) 3.29 s ± 43.2 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) In [5]: %timeit test\_hdf\_fixed\_write(df) 19.4 ms ± 560 µs per loop (m...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/io.rst
main
pandas
[ 0.018769830465316772, -0.08613679558038712, -0.05694790929555893, 0.03600810095667839, 0.018462900072336197, -0.13738441467285156, -0.025018030777573586, 0.020058514550328255, -0.013097004033625126, 0.030061149969697, -0.014573203399777412, 0.002143892226740718, -0.03359222039580345, -0.09...
0.044487
.. currentmodule:: pandas {{ header }} .. \_integer\_na: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Nullable integer data type \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* .. note:: IntegerArray is currently experimental. Its API or implementation may change without warning. Uses :attr:`pandas.NA` as ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/integer_na.rst
main
pandas
[ -0.013684017583727837, 0.05674837902188301, -0.08387470990419388, 0.03253200277686119, 0.08067288249731064, -0.042772889137268066, 0.023242855444550514, -0.043774668127298355, -0.010412291623651981, -0.02335532382130623, -0.0018416359089314938, -0.06913616508245468, -0.012086325325071812, ...
-0.010877
{{ header }} .. \_string\_migration\_guide: ========================================================= Migration guide for the new string data type (pandas 3.0) ========================================================= The upcoming pandas 3.0 release introduces a new, default string data type. This will most likely caus...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/migration-3-strings.rst
main
pandas
[ -0.046217285096645355, -0.018422842025756836, 0.010248308070003986, -0.051448747515678406, 0.062332555651664734, -0.07408224791288376, -0.039806339889764786, -0.011191240511834621, -0.09446382522583008, 0.00027555672568269074, 0.025157997384667397, -0.07114221155643463, -0.14027723670005798,...
-0.063239
only store strings. This also means that it will raise an error if you try to store a non-string value in it (see below for more details). Missing values with the new string dtype are always represented as ``NaN`` (``np.nan``), and the missing value behavior is similar to other default dtypes. This new string dtype sho...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/migration-3-strings.rst
main
pandas
[ -0.05050287023186684, -0.03262677416205406, -0.0511346310377121, -0.03255503252148628, -0.04585840553045273, -0.04791871830821037, -0.013246394693851471, 0.013644156977534294, 0.007287910208106041, -0.005567097570747137, 0.07225707918405533, -0.024320088326931, -0.04544493928551674, -0.045...
0.039878
is not possible to use ``"str"``. While this works for pandas 3.x, it raises an error in pandas 2.x. As an alternative, you can select both ``object`` (for pandas 2.x) and ``"string"`` (for pandas 3.x; which will also select the default ``str`` dtype and does not error on pandas 2.x): .. code-block:: python # can use `...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/migration-3-strings.rst
main
pandas
[ -0.014247259125113487, -0.08852548897266388, 0.0024324210826307535, -0.015276026912033558, 0.08476334065198898, -0.07870987802743912, 0.024131542071700096, -0.003543198574334383, -0.012823247350752354, 0.0075328839011490345, 0.06449958682060242, -0.06226080283522606, -0.08388068526983261, ...
-0.001793
>>> ser = pd.Series(["\u2600", "\ud83d"], dtype=object) >>> ser 0 ☀ 1 \ud83d dtype: object However, when using the string dtype using ``pyarrow`` under the hood, this can only store valid unicode data, and otherwise it will raise an error: .. code-block:: python >>> ser = pd.Series(["\u2600", "\ud83d"]) ---------------...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/migration-3-strings.rst
main
pandas
[ -0.05668461695313454, -0.04325723275542259, -0.07157706469297409, -0.03398479148745537, -0.11784122884273529, -0.04873111471533775, -0.0443144291639328, 0.030582817271351814, 0.004581183660775423, -0.07298099249601364, 0.023518342524766922, -0.01541825383901596, -0.10602261126041412, 0.027...
-0.044731
pandas < 3, calling the :meth:`~pandas.Series.prod` method on a Series with string data would generally raise an error, except when the Series was empty or contained only a single string (potentially with missing values): .. code-block:: python >>> ser = pd.Series(["a", None], dtype=object) >>> ser.prod() 'a' When the ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/migration-3-strings.rst
main
pandas
[ -0.07425697892904282, -0.05898889899253845, -0.02755291759967804, -0.012877910397946835, -0.01700454205274582, -0.07244305312633514, -0.04249020293354988, 0.047601643949747086, 0.06831351667642593, -0.028702855110168457, 0.018905315548181534, -0.00009681638766778633, -0.0570540614426136, -...
0.006733
.. \_gotchas: {{ header }} \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Frequently Asked Questions (FAQ) \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* .. \_df-memory-usage: DataFrame memory usage ---------------------- The memory usage of a :class:`DataFrame` (including the index)...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/gotchas.rst
main
pandas
[ 0.003930437844246626, 0.043903056532144547, -0.12938286364078522, 0.05829010531306267, 0.07146477699279785, -0.07465154677629471, 0.08316529542207718, 0.03809382766485214, 0.04721760377287865, -0.008743020705878735, 0.036307815462350845, -0.025332177057862282, -0.017826955765485764, -0.013...
0.055788
the \*\*index\*\*, not membership among the values. .. ipython:: python s = pd.Series(range(5), index=list("abcde")) 2 in s 'b' in s If this behavior is surprising, keep in mind that using ``in`` on a Python dictionary tests keys, not values, and :class:`Series` are dict-like. To test for membership in the values, use ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/gotchas.rst
main
pandas
[ -0.021378271281719208, -0.042259618639945984, -0.013804967515170574, -0.003916746936738491, 0.07092220336198807, -0.05866518244147301, 0.024006379768252373, -0.018165744841098785, 0.0008771013817749918, -0.002355897566303611, 0.026439988985657692, 0.015980185940861702, 0.0021417990792542696,...
-0.048217
In the absence of high performance ``NA`` support being built into NumPy from the ground up, the primary casualty is the ability to represent NAs in integer arrays. For example: .. ipython:: python s = pd.Series([1, 2, 3, 4, 5], index=list("abcde")) s s.dtype s2 = s.reindex(["a", "b", "c", "f", "u"]) s2 s2.dtype This t...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/gotchas.rst
main
pandas
[ -0.03005828708410263, -0.06274733692407608, 0.00914789829403162, -0.02083483524620533, 0.006666172295808792, -0.030154194682836533, -0.02606428973376751, -0.07268215715885162, -0.012975145131349564, -0.01890696957707405, -0.01337304525077343, -0.0012063911417499185, 0.008935809135437012, 0...
0.025911
.. \_options: {{ header }} \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Options and settings \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Overview -------- pandas has an options API to configure and customize global behavior related to :class:`DataFrame` display, data behavior and more. Options have a full "dotted-style", case...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/options.rst
main
pandas
[ -0.01973811909556389, 0.03001433052122593, -0.03897038847208023, 0.01877516508102417, -0.00024981366004794836, -0.016579139977693558, 0.008977359160780907, 0.04486709088087082, -0.08292245864868164, -0.00835458468645811, 0.0033761581871658564, -0.006217564456164837, -0.020307451486587524, ...
-0.028734
repr. .. ipython:: python pd.set\_option("display.max\_rows", 8) pd.set\_option("display.min\_rows", 4) # below max\_rows -> all rows shown df = pd.DataFrame(np.random.randn(7, 2)) df # above max\_rows -> only min\_rows (4) rows shown df = pd.DataFrame(np.random.randn(9, 2)) df pd.reset\_option("display.max\_rows") pd....
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/options.rst
main
pandas
[ -0.00454302504658699, -0.013320999220013618, -0.032498035579919815, -0.05015521124005318, 0.04706081375479698, 0.004726273473352194, -0.02541939541697502, -0.00902901217341423, -0.057664696127176285, 0.020061014220118523, 0.02166539616882801, 0.034661464393138885, -0.03379179909825325, 0.0...
-0.101614
depending on the terminal setting or encoding. The option ``display.unicode.ambiguous\_as\_wide`` can be used to handle the ambiguity. By default, an "ambiguous" character's width, such as "¡" (inverted exclamation) in the example below, is taken to be 1. .. ipython:: python df = pd.DataFrame({"a": ["xxx", "¡¡"], "b": ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/options.rst
main
pandas
[ 0.03981678560376167, -0.04089236631989479, 0.0012321706162765622, -0.002271458739414811, -0.01687946543097496, -0.07358910143375397, -0.01588909700512886, 0.01705128699541092, 0.019752947613596916, -0.043555937707424164, 0.09889715909957886, -0.012402505613863468, -0.05054975673556328, 0.0...
-0.082299
.. \_missing\_data: {{ header }} \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Working with missing data \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Values considered "missing" ~~~~~~~~~~~~~~~~~~~~~~~~~~~ pandas uses different sentinel values to represent a missing (also referred to as NA) depending on the ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/missing_data.rst
main
pandas
[ -0.031755827367305756, -0.005962993483990431, 0.002071936149150133, 0.03541143611073494, 0.056419871747493744, -0.07109569758176804, -0.021220514550805092, -0.03172339126467705, -0.005718667525798082, 0.0037144734524190426, 0.04143012687563896, -0.09305424243211746, -0.013030936010181904, ...
0.054087
Logical operations ------------------ For logical operations, :class:`NA` follows the rules of the `three-valued logic `\_\_ (or \*Kleene logic\*, similarly to R, SQL and Julia). This logic means to only propagate missing values when it is logically required. For example, for the logical "or" operation (``|``), if one ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/missing_data.rst
main
pandas
[ -0.04243098199367523, 0.03972078114748001, 0.02214682660996914, 0.015037763863801956, -0.025041496381163597, -0.04024587944149971, 0.03459812328219414, -0.07941325008869171, 0.010559991002082825, 0.030482346192002296, 0.09508238732814789, -0.0025456815492361784, 0.07492468506097794, 0.0408...
0.053973
discussed in the :ref:`data structure overview ` (and listed :ref:`here ` and :ref:`here `) all account for missing data. When summing data, NA values or empty data will be treated as zero. .. ipython:: python pd.Series([np.nan]).sum() pd.Series([], dtype="float64").sum() When taking the product, NA values or empty dat...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/missing_data.rst
main
pandas
[ -0.0593445785343647, -0.02327261120080948, 0.007433474529534578, -0.02319345809519291, 0.0113659193739295, -0.06864526867866516, 0.012846828438341618, 0.028895694762468338, 0.001787253888323903, 0.03457824885845184, 0.05457024648785591, -0.06471635401248932, 0.02120993100106716, -0.0606544...
0.009089
df = pd.DataFrame( { "A": [1, 2.1, np.nan, 4.7, 5.6, 6.8], "B": [0.25, np.nan, np.nan, 4, 12.2, 14.4], } ) df df.interpolate(method="barycentric") df.interpolate(method="pchip") df.interpolate(method="akima") When interpolating via a polynomial or spline approximation, you must also specify the degree or order of the a...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/missing_data.rst
main
pandas
[ -0.06377086043357849, -0.06762305647134781, 0.030224496498703957, -0.06204881891608238, -0.04803873971104622, -0.07398854196071625, -0.02701234631240368, -0.0091556953266263, -0.017911115661263466, 0.01947261206805706, 0.03185947984457016, -0.008539491333067417, -0.029372919350862503, -0.0...
0.012604
note:: A regular expression object from ``re.compile`` is a valid input as well.
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/missing_data.rst
main
pandas
[ -0.033846352249383926, 0.10054480284452438, -0.01052462961524725, -0.013511817902326584, -0.06156430393457413, 0.03721460700035095, -0.018629761412739754, -0.00890903826802969, -0.08002229779958725, 0.03238563984632492, -0.04646759852766991, -0.03848126903176308, 0.000876397592946887, 0.02...
0.07701
.. \_dsintro: {{ header }} \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Intro to data structures \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* We'll start with a quick, non-comprehensive overview of the fundamental data structures in pandas to get you started. The fundamental behavior about data types, indexing,...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/dsintro.rst
main
pandas
[ -0.04241251200437546, -0.01958312653005123, -0.002181930234655738, -0.04172305762767792, 0.012255272828042507, -0.08525850623846054, -0.007606069557368755, 0.019562948495149612, -0.07471911609172821, -0.00043699124944396317, 0.015314963646233082, -0.005479856859892607, -0.07006897032260895, ...
0.119168
more \*concrete\* arrays like a :class:`numpy.ndarray`. pandas knows how to take an :class:`~pandas.api.extensions.ExtensionArray` and store it in a :class:`Series` or a column of a :class:`DataFrame`. See :ref:`basics.dtypes` for more. While :class:`Series` is ndarray-like, if you need an \*actual\* ndarray, then use ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/dsintro.rst
main
pandas
[ -0.02499321475625038, -0.024363595992326736, -0.07587295025587082, -0.0204149316996336, 0.014284037053585052, -0.07467886060476303, -0.009256834164261818, -0.043114155530929565, -0.04791603982448578, -0.03540642186999321, -0.025438329204916954, 0.03225501999258995, -0.07352163642644882, 0....
0.091346
you pass an index and / or columns, you are guaranteeing the index and / or columns of the resulting DataFrame. Thus, a dict of Series plus a specific index will discard all data not matching up to the passed index. If axis labels are not passed, they will be constructed from the input data based on common sense rules....
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/dsintro.rst
main
pandas
[ -0.023182479664683342, -0.017491139471530914, -0.007805804256349802, -0.055221106857061386, 0.01829860545694828, -0.05300285294651985, -0.03129297494888306, -0.08515773713588715, 0.04742838069796562, 0.02021070010960102, 0.02386651746928692, 0.02436954341828823, -0.05942832678556442, -0.01...
-0.068099
namedtuple("Point", "x y") pd.DataFrame([Point(0, 0), Point(0, 3), (2, 3)]) Point3D = namedtuple("Point3D", "x y z") pd.DataFrame([Point3D(0, 0, 0), Point3D(0, 3, 5), Point(2, 3)]) .. \_basics.dataframe.from\_list\_dataclasses: From a list of dataclasses ~~~~~~~~~~~~~~~~~~~~~~~~~~ Data Classes as introduced in `PEP557 ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/dsintro.rst
main
pandas
[ -0.02591106854379177, -0.06132464110851288, -0.03568803891539574, -0.051178473979234695, 0.025239765644073486, -0.04834146425127983, 0.09039591997861862, -0.05254670977592468, -0.07555080950260162, -0.020206332206726074, 0.030093446373939514, 0.020355327054858208, -0.035585399717092514, 0....
-0.004267
leaving the original DataFrame untouched. Passing a callable, as opposed to an actual value to be inserted, is useful when you don't have a reference to the DataFrame at hand. This is common when using :meth:`~pandas.DataFrame.assign` in a chain of operations. For example, we can limit the DataFrame to just those obser...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/dsintro.rst
main
pandas
[ 0.01909266598522663, -0.0662325918674469, -0.02385656163096428, 0.00432246271520853, 0.09899488091468811, -0.07200164347887039, 0.041063982993364334, -0.024530721828341484, -0.00870959646999836, 0.012072846293449402, 0.010061957873404026, 0.004547061864286661, -0.07267900556325912, 0.00307...
-0.036042
df2 -df1 Transposing ~~~~~~~~~~~ To transpose, access the ``T`` attribute or :meth:`DataFrame.transpose`, similar to an ndarray: .. ipython:: python # only show the first 5 rows df[:5].T .. \_dsintro.numpy\_interop: DataFrame interoperability with NumPy functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Most Num...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/dsintro.rst
main
pandas
[ -0.03913166746497154, -0.06461137533187866, -0.03774155303835869, -0.008645176887512207, 0.04381370544433594, -0.13481155037879944, -0.06649451702833176, -0.023454593494534492, -0.03249138593673706, 0.045111283659935, -0.0260846596211195, 0.01213072519749403, -0.08877341449260712, -0.00223...
0.109514
.. \_merging: {{ header }} .. ipython:: python :suppress: from matplotlib import pyplot as plt import pandas.util.\_doctools as doctools p = doctools.TablePlotter() \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Merge, join, concatenate and compare \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/merging.rst
main
pandas
[ 0.017591973766684532, -0.032719168812036514, 0.0048981402069330215, -0.0561552569270134, 0.0403292179107666, -0.029587889090180397, -0.011799432337284088, 0.025490716099739075, -0.024484004825353622, -0.0022186352871358395, 0.06599196791648865, -0.01739676669239998, -0.04357745125889778, -...
-0.045908
indexes on the concatenation axis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For :class:`DataFrame` objects which don't have a meaningful index, the ``ignore\_index`` ignores overlapping indexes. .. ipython:: python result = pd.concat([df1, df4], ignore\_index=True, sort=False) result .. ipython:: python :suppress: @sa...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/merging.rst
main
pandas
[ 0.02927025407552719, -0.027615342289209366, 0.015146085061132908, -0.033303651958703995, 0.06664770096540451, -0.05634771287441254, 0.010081326588988304, -0.00901802722364664, 0.025906475260853767, -0.008552228100597858, 0.07479578256607056, 0.052249711006879807, -0.03937273100018501, -0.0...
-0.065798
to one or more columns in a different :class:`DataFrame`. \* \*\*many-to-many\*\*: joining columns on columns. .. note:: When joining columns on columns, potentially a many-to-many join, any indexes on the passed :class:`DataFrame` objects \*\*will be discarded\*\*. For a \*\*many-to-many\*\* join, if a key combination...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/merging.rst
main
pandas
[ 0.0729251578450203, -0.06111437454819679, -0.019968535751104355, -0.0409984216094017, 0.013962800614535809, -0.017120257019996643, 0.03927764296531677, -0.06091364845633507, -0.05214743688702583, 0.025397079065442085, 0.03181653469800949, 0.062060944736003876, 0.01649637334048748, -0.02445...
-0.087263
the dimensions of the result and can cause a memory overflow. .. \_merging.validation: Merge key uniqueness ~~~~~~~~~~~~~~~~~~~~ The ``validate`` argument checks whether the uniqueness of merge keys. Key uniqueness is checked before merge operations and can protect against memory overflows and unexpected key duplicatio...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/merging.rst
main
pandas
[ -0.0018444373272359371, -0.04161465913057327, 0.01885867491364479, -0.036987315863370895, 0.02375497668981552, -0.0412258543074131, -0.0015493282116949558, -0.02746632881462574, 0.009163453243672848, -0.01765327900648117, 0.06050259619951248, 0.08124640583992004, -0.010073656216263771, -0....
-0.073572
left = pd.DataFrame( { "A": ["A0", "A1", "A2", "A3"], "B": ["B0", "B1", "B2", "B3"], "key1": ["K0", "K0", "K1", "K2"], "key2": ["K0", "K1", "K0", "K1"], } ) index = pd.MultiIndex.from\_tuples( [("K0", "K0"), ("K1", "K0"), ("K2", "K0"), ("K2", "K1")] ) right = pd.DataFrame( {"C": ["C0", "C1", "C2", "C3"], "D": ["D0", "D...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/merging.rst
main
pandas
[ 0.01384890265762806, -0.025252414867281914, 0.018376195803284645, -0.045953795313835144, -0.012705422937870026, -0.0068727112375199795, 0.013339291326701641, -0.07379946857690811, 0.0014155021635815501, 0.032049618661403656, 0.0026101614348590374, 0.04008353874087334, -0.0056943390518426895,...
0.00734
joined using only some of the levels of a :class:`MultiIndex`, the extra levels will be dropped from the resulting join. To preserve those levels, use :meth:`DataFrame.reset\_index` on those level names to move those levels to columns prior to the join. .. \_merging.multiple\_join: Joining multiple :class:`DataFrame` ~...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/merging.rst
main
pandas
[ 0.026229936629533768, -0.03071201965212822, 0.0013532962184399366, 0.006773172412067652, 0.0852629616856575, -0.02258906699717045, -0.019452214241027832, 0.01901647448539734, -0.059416014701128006, -0.018322311341762543, 0.003238111501559615, 0.03093772567808628, -0.043858591467142105, -0....
-0.088165
are equal, they will be shown as ``NaN``. Furthermore, if all values in an entire row / column are equal, that row / column will be omitted from the result. The remaining differences will be aligned on columns. Stack the differences on rows. .. ipython:: python df.compare(df2, align\_axis=0) Keep all original rows and ...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/merging.rst
main
pandas
[ 0.005890892818570137, -0.014703258872032166, 0.005139829125255346, -0.07604023814201355, 0.04444266855716705, -0.10086312890052795, -0.06862977892160416, -0.0647943839430809, 0.007815157994627953, 0.02318969927728176, 0.06955628842115402, 0.04446203634142876, -0.033484939485788345, -0.0096...
-0.074189
.. \_indexing: {{ header }} \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Indexing and selecting data \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* The axis labeling information in pandas objects serves many purposes: \* Identifies data (i.e. provides \*metadata\*) using known indicators, important fo...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/indexing.rst
main
pandas
[ -0.04910067468881607, -0.02145887166261673, -0.044004954397678375, -0.03923461213707924, 0.04280100390315056, -0.05569586902856827, 0.039023760706186295, -0.0074156103655695915, 0.0035656646359711885, 0.029672905802726746, 0.026130028069019318, -0.024728501215577126, -0.07586981356143951, ...
0.036173
and also ``[]`` indexing can accept a ``callable`` as indexer. See more at :ref:`Selection By Callable `. .. note:: Destructuring tuple keys into row (and column) indexes occurs \*before\* callables are applied, so you cannot return a tuple from a callable to index both rows and columns. Getting values from an object w...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/indexing.rst
main
pandas
[ -0.04045668616890907, -0.04108719900250435, -0.05274033546447754, -0.04173494130373001, 0.01890861615538597, -0.06681443005800247, 0.05423612520098686, -0.034473635256290436, -0.020922258496284485, 0.03217135742306709, 0.02787095494568348, 0.046349506825208664, -0.05587884038686752, -0.028...
-0.020057
existing method name, e.g. ``s.min`` is not allowed, but ``s['min']`` is possible. - Similarly, the attribute will not be available if it conflicts with any of the following list: ``index``, ``major\_axis``, ``minor\_axis``, ``items``. - In any of these cases, standard indexing will still work, e.g. ``s['1']``, ``s['mi...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/indexing.rst
main
pandas
[ 0.0534929558634758, 0.010358435101807117, -0.02820245362818241, -0.022422607988119125, 0.05297214165329933, -0.007264905609190464, 0.037857621908187866, 0.022515850141644478, -0.05619870871305466, 0.01762334816157818, 0.03598642721772194, 0.0732216164469719, -0.0397145077586174, -0.0010788...
-0.024548
s1 With a DataFrame: .. ipython:: python df1 = pd.DataFrame(np.random.randn(6, 4), index=list('abcdef'), columns=list('ABCD')) df1 df1.loc[['a', 'b', 'd'], :] Accessing via label slices: .. ipython:: python df1.loc['d':, 'A':'C'] For getting a cross section using a label (equivalent to ``df.xs('a')``): .. ipython:: pyt...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/indexing.rst
main
pandas
[ 0.030927883461117744, -0.002060391241684556, -0.05138864740729332, -0.05115136876702309, 0.11039383709430695, 0.002937786979600787, 0.0649958997964859, -0.12709970772266388, -0.03259747102856636, -0.0030426473822444677, 0.06147594377398491, -0.04885544255375862, 0.025005627423524857, 0.027...
-0.040116
following are valid inputs: \* An integer e.g. ``5``. \* A list or array of integers ``[4, 3, 0]``. \* A slice object with ints ``1:7``. \* A boolean array. \* A ``callable``, see :ref:`Selection By Callable `. \* A tuple of row (and column) indexes, whose elements are one of the above types. .. ipython:: python s1 = p...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/indexing.rst
main
pandas
[ -0.020714905112981796, -0.05978040024638176, -0.05258697271347046, -0.054195281118154526, 0.04256308451294899, -0.04039840027689934, 0.053246330469846725, -0.0758732333779335, -0.056130196899175644, 0.005501057952642441, -0.027742600068449974, 0.06116493418812752, -0.0588507279753685, 0.01...
0.010803
= [1, 2, 3] s.loc[s.index.intersection(labels)] Having a duplicated index will raise for a ``.reindex()``: .. ipython:: python :okexcept: s = pd.Series(np.arange(4), index=['a', 'a', 'b', 'c']) labels = ['c', 'd'] s.reindex(labels) Generally, you can intersect the desired labels with the current axis, and then reindex....
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/indexing.rst
main
pandas
[ -0.038706690073013306, -0.052640922367572784, 0.0005641861935146153, -0.02590578980743885, 0.032068781554698944, -0.01823684573173523, 0.07740861922502518, -0.10323366522789001, -0.0009163516806438565, -0.037818241864442825, 0.0233085285872221, 0.0003429940843489021, -0.0075475298799574375, ...
-0.017309
\_indexing.basics.get\_value: Fast scalar value getting and setting ------------------------------------- Since indexing with ``[]`` must handle a lot of cases (single-label access, slicing, boolean indexing, etc.), it has a bit of overhead in order to figure out what you're asking for. If you only want to access a sca...
https://github.com/pandas-dev/pandas/blob/main//doc/source/user_guide/indexing.rst
main
pandas
[ -0.007488613482564688, 0.03352605178952217, -0.005053558386862278, -0.021173758432269096, 0.0224623903632164, -0.036651793867349625, 0.029156377539038658, -0.031202910467982292, 0.00041858863551169634, -0.04553838446736336, 0.03800611197948456, 0.05580398812890053, -0.09879471361637115, -0...
0.019175