id
stringlengths
16
145
text
stringlengths
1
179k
title
stringclasses
1 value
pandas_user_guide/pandas_user_guide_10_14.txt
meseries plots * Suppressing tick resolution adjustment * Automatic date tick adjustment * Subplots * Using layout and targeting multiple axes * Plotting with error bars * Plotting tables * Colormaps * Plotting directly with Matplotlib * Plotting backends [ __ Show Source ](.....
pandas_user_guide/tutorialbasicvectori_75_0.txt
Share
pandas_user_guide/pandas_user_guide_8_4.txt
4 C4 D4 5 A5 B5 C5 D5 6 A6 B6 C6 D6 7 A7 B7 C7 D7 z 8 A8 B8 C8 D8 9 A9 B9 C9 D9 10 A10 B10 C10 D10 11 A11 B11 C11 D11 ![../_images/merging_concat_dict.png](../_images/merging_concat_dict.png) ...
pandas_user_guide/vectorizationinpanda_32_0.txt
In this example, the addition operation ` df['A'] + df['B'] ` is applied to the entire columns 'A' and 'B' simultaneously, and the result is stored in column 'C'.
pandas_user_guide/pandas_user_guide_3_3.txt
by="B") Out[23]: A B C D 2013-01-03 -0.861849 -2.104569 -0.494929 1.071804 2013-01-04 0.721555 -0.706771 -1.039575 0.271860 2013-01-01 0.469112 -0.282863 -1.509059 -1.135632 2013-01-02 1.212112 -0.173215 0.119209 -1.044236 2013-01-06 -0.67369...
pandas_user_guide/pandas_user_guide_24_0.txt
Skip to main content __ Back to top __ ` Ctrl ` \+ ` K ` [ ![pandas 2.2.1 documentation - Home](../_static/pandas.svg) ](../index.html) Site Navigation * [ Getting started ](../getting_started/index.html) * [ User Guide ](index.html) * [ API reference ](../reference/index.html) * [ Development ](../develop...
pandas_user_guide/pandas_user_guide_27_47.txt
e.xlsb", engine="calamine") ## Clipboard # A handy way to grab data is to use the ` read_clipboard() ` method, which takes the contents of the clipboard buffer and passes them to the ` read_csv ` method. For instance, you can copy the following text to the clipboard (CTRL-C on many operating systems): ...
pandas_user_guide/pandas_user_guide_2_33.txt
In [412]: p.asfreq("D", "s") Out[412]: Period('2011-01-01', 'D') In [413]: p.asfreq("D", "e") Out[413]: Period('2011-03-31', 'D') ## Converting between representations # Timestamped data can be converted to PeriodIndex-ed data using ` to_period ` and vice-versa using ` to_timestamp `...
pandas_user_guide/vectorizationinpanda_84_0.txt
So let’s see how much you’ve retained from the blog
pandas_user_guide/pandas_user_guide_18_8.txt
time- interval) ### Splitting # [ Splitting a frame ](https://stackoverflow.com/questions/13353233/best-way- to-split-a-dataframe-given-an-edge/15449992#15449992) Create a list of dataframes, split using a delineation based on logic included in rows. In [146]: df = pd.DataFrame( .....: da...
pandas_user_guide/pandas_user_guide_11_3.txt
#pandas.Series.to_numpy "pandas.Series.to_numpy") calls are needed to utilize this function. In [14]: %timeit apply_integrate_f(df["a"].to_numpy(), df["b"].to_numpy(), df["N"].to_numpy()) 831 us +- 4.54 us per loop (mean +- std. dev. of 7 runs, 1,000 loops each) Performance has improved from th...
pandas_user_guide/pandasvectorization_5_0.txt
Vectorize your data
pandas_user_guide/pandas_user_guide_26_24.txt
: x["b"].sum(), "c_mean": x["c"].mean()} .....: return pd.Series(result, name="metrics") .....: In [281]: result = df.groupby("a").apply(compute_metrics, include_groups=False) In [282]: result Out[282]: metrics b_sum c_mean a 0 2.0 ...
pandas_user_guide/pandas_user_guide_5_28.txt
and an index level name then a warning is issued and the column takes precedence. This will result in an ambiguity error in a future version. ### searchsorted # Series has the [ ` searchsorted() ` ](../reference/api/pandas.Series.searchsorted.html#pandas.Series.searchsorted "pandas.Series.searchsorted") method, w...
pandas_user_guide/pandas_user_guide_19_3.txt
18]: True If this behavior is surprising, keep in mind that using ` in ` on a Python dictionary tests keys, not values, and [ ` Series ` ](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") are dict- like. To test for membership in the values, use the method [ ` isin() ` ](../reference/api/pand...
pandas_user_guide/vectorizationinpanda_52_0.txt
Vectorization is a powerful technique in programming that speeds up code execution by performing operations on entire arrays or collections of data elements at once, rather than processing them one by one in a loop. This approach takes advantage of low-level, optimized hardware instructions and libraries to make comput...
pandas_user_guide/tutorialbasicvectori_31_0.txt
[ \+ Follow ](https://www.linkedin.com/signup/cold- join?session_redirect=%2Fpulse%2Ftutorial-basic-vectorization-pandas-iterrows- apply-duc-lai-trung-minh-75d4c%2F&trk=article-ssr-frontend-pulse_publisher- author-card)
pandas_user_guide/vectorizationinpanda_75_0.txt
print(f"NumPy Vectorized Approach: {numpy_time:.5f} seconds") print(f"Traditional Loop-Based Approach: {loop_time:.5f} seconds")
pandas_user_guide/pandas_user_guide_9_13.txt
t_index("B") In [152]: df2.index Out[152]: CategoricalIndex(['a', 'a', 'b', 'b', 'c', 'a'], categories=['c', 'a', 'b'], ordered=False, dtype='category', name='B') Indexing with ` __getitem__/.iloc/.loc ` works similarly to an ` Index ` with duplicates. The indexers **must** be in the category or th...
pandas_user_guide/pandas_user_guide_26_1.txt
examine the results of the apply step and try to sensibly combine them into a single result if it doesn’t fit into either of the above three categories. Note An operation that is split into multiple steps using built-in GroupBy operations will be more efficient than using the ` apply ` method with a user-defined ...
pandas_user_guide/pandas_user_guide_20_9.txt
False 6 False False False False False 7 False False False False False 8 False False False False False 9 False False False False False [ ` get_dummies() ` ](../reference/api/p...
pandas_user_guide/tutorialbasicvectori_48_0.txt
Vectorized operations in Pandas can be applied to entire columns or Series, which results in faster and more concise code. For example, to add two columns element-wise, you can do:
pandas_user_guide/pandas_user_guide_5_24.txt
Frame.iterrows.html#pandas.DataFrame.iterrows "pandas.DataFrame.iterrows") returns a Series for each row, it does **not** preserve dtypes across the rows (dtypes are preserved across columns for DataFrames). For example, In [260]: df_orig = pd.DataFrame([[1, 1.5]], columns=["int", "float"]) In [...
pandas_user_guide/vectorizationinpanda_12_0.txt
[ Follow ](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fsubscribe%2Fuser%2Ff319c9e06fc1&operation=register&redirect=https%3A%2F%2Fpython.plainenglish.io%2Fvectorization- in-pandas-simplifying-data- operations-3a4fda08a184&user=Gaurav+Kumar&userId=f319c9e06fc1&source=post_page-f319c9e06fc1 ----3a...
pandas_user_guide/pandasvectorization_17_0.txt
In [54]:
pandas_user_guide/pandas_user_guide_25_2.txt
A B C D 2000-01-01 0.469112 -0.282863 -1.509059 -1.135632 2000-01-02 1.212112 -0.173215 0.119209 -1.044236 2000-01-03 -0.861849 -2.104569 -0.494929 1.071804 2000-01-04 0.721555 -0.706771 -1.039575 0.271860 2000-01-05 -0.424972 0.567020 0.276232 -1.087401 ...
pandas_user_guide/pandas_user_guide_26_18.txt
` . Compare In [203]: df.groupby("A", group_keys=True).apply(lambda x: x, include_groups=False) Out[203]: B C D A bar 1 one 0.254161 1.511763 3 three 0.215897 -0.990582 5 two -0.077118 1.211526 foo...
pandas_user_guide/pandas_user_guide_27_35.txt
cument. However, that does NOT mean that it is “correct”, since the > process of fixing markup does not have a single definition. > > * [ **html5lib** ](https://github.com/html5lib/html5lib-python) is pure > Python and requires no additional build steps beyond its own installation. * Drawbacks > * The ...
pandas_user_guide/howtospeeduppythonpa_59_0.txt
1. Use Built-in Pandas and NumPy Functions that have implemented C like ‘sum()’, ‘mean()’, or ‘max()’. 2. Use vectorized operations that can apply to entire DataFrames and Series including mathematical operations, comparisons, and logic to create a boolean mask to select multiple rows from your data set. 3. You can use...
pandas_user_guide/pandas_user_guide_9_20.txt
/pandas/pandas/pandas/core/indexes/base.py:6885, in Index.slice_locs(self, start, end, step) 6883 end_slice = None 6884 if end is not None: -> 6885 end_slice = self.get_slice_bound(end, "right") 6886 if end_slice is None: 6887 end_slice = len(self) File ~/work/pandas/pan...
pandas_user_guide/pandas_user_guide_24_15.txt
| -0.52 | -6.60 | -3.48 | -0.04 | -4.60 | 0.51 | -5.85 | 3.23 | 2.40 | 5.08 9 | 0.38 | 5.54 | -4.49 | -0.80 | 7.05 | -2.64 | -0.44 | 5.35 | -1.96 | -0.33 | -0.80 | 0.26 | -3.37 | -0.82 | -6.05 | -2.61 | -8.45 | -4.45 | 0.41 | -4.71 | 1.89 | -6.93 | 2....
pandas_user_guide/pandas_user_guide_9_15.txt
_callable, axis=axis) File ~/work/pandas/pandas/pandas/core/indexing.py:1431, in _LocIndexer._getitem_axis(self, key, axis) 1429 # fall thru to straight lookup 1430 self._validate_key(key, axis) -> 1431 return self._get_label(key, axis=axis) File ~/work/pandas/pandas/pandas/core/inde...
pandas_user_guide/pandas_user_guide_5_25.txt
In [278]: stz = s.dt.tz_localize("US/Eastern") In [279]: stz Out[279]: 0 2013-01-01 09:10:12-05:00 1 2013-01-02 09:10:12-05:00 2 2013-01-03 09:10:12-05:00 3 2013-01-04 09:10:12-05:00 dtype: datetime64[ns, US/Eastern] In [280]: stz.dt.tz Out[280]: <DstTzInfo 'U...
pandas_user_guide/pandas_user_guide_26_5.txt
pd.DataFrame( ....: { ....: "A": ["foo", "bar", "foo", "bar", "foo", "bar", "foo", "foo"], ....: "B": ["one", "one", "two", "three", "two", "two", "one", "three"], ....: "C": np.random.randn(8), ....: "D": np.random.randn(8), ....: } ...
pandas_user_guide/howtospeeduppythonpa_22_0.txt
We are first going to import our frameworks and generate some random code before we start:
pandas_user_guide/pandas_user_guide_27_55.txt
09 -0.811230 2013-01-08 0.947422 -0.671233 2013-01-09 -0.183798 -1.211230 2013-01-10 0.361428 0.887304 Use inline column reference. In [516]: store.select("dfq", where="A>0 or C>0") Out[516]: A B C D 2013-01-02 0.658179 0.3628...
pandas_user_guide/pandas_user_guide_24_11.txt
h functions is: * [ .highlight_null ](../reference/api/pandas.io.formats.style.Styler.highlight_null.html) : for use with identifying missing data. * [ .highlight_min ](../reference/api/pandas.io.formats.style.Styler.highlight_min.html) and [ .highlight_max ](../reference/api/pandas.io.formats.style.Styler.hi...
pandas_user_guide/vectorizationinpanda_122_0.txt
Careers
pandas_user_guide/howtospeeduppythonpa_112_0.txt
It provides powerful data structures (such as the DataFrame and Series) and data manipulation tools to work with structured data, including reading and writing data in various formats (e.g. CSV, Excel, JSON) and filtering, cleaning, and transforming data. Additionally, it supports time series data and provides powerful...
pandas_user_guide/pandas_user_guide_9_10.txt
bar one 0.408204 two -0.863838 baz one 1.063327 two -0.251905 foo one 1.266143 two 0.206053 qux one 0.299368 two -2.213588 dtype: float64 In [106]: s.sort_index(level=0) Out[106]: bar one 0.408204 two -0.86...
pandas_user_guide/pandas_user_guide_15_2.txt
0.096061 0.580473 2000-01-01 00:01:30 992 Bob 0.142482 0.041665 2000-01-01 00:02:00 960 Bob -0.036235 0.802159 ... ... ... ... ... 2000-12-30 23:58:00 1022 Alice 0.266191 0.875579 2000-12-30 23:58:30 974 Alice -0.009826 0.413686 ...
pandas_user_guide/pandas_user_guide_7_1.txt
ut [ pandas/core/config_init.py ](https://github.com/pandas-dev/pandas/blob/main/pandas/core/config_init.py) for more information. All of the functions above accept a regexp pattern ( ` re.search ` style) as an argument, to match an unambiguous substring: In [5]: pd.get_option("display.chop_threshold")...
pandas_user_guide/pandas_user_guide_11_2.txt
double s, dx ....: s = 0 ....: dx = (b - a) / N ....: for i in range(N): ....: s += f_typed(a + i * dx) ....: return s * dx ....: In [11]: %timeit df.apply(lambda x: integrate_f_typed(x["a"], x["b"], x["N"]), axis=1) 7.95 ms +- 8...
pandas_user_guide/pandas_user_guide_14_5.txt
], "two": [4.0, 3.0, 2.0, 1.0]} In [46]: pd.DataFrame(d) Out[46]: one two 0 1.0 4.0 1 2.0 3.0 2 3.0 2.0 3 4.0 1.0 In [47]: pd.DataFrame(d, index=["a", "b", "c", "d"]) Out[47]: one two a 1.0 4.0 b 2.0 3.0 c 3.0 2.0 d 4.0 1.0 ...
pandas_user_guide/pandas_user_guide_14_4.txt
o has a ` name ` attribute: In [33]: s = pd.Series(np.random.randn(5), name="something") In [34]: s Out[34]: 0 -0.494929 1 1.071804 2 0.721555 3 -0.706771 4 -1.039575 Name: something, dtype: float64 In [35]: s.name Out[35]: 'something' ...
pandas_user_guide/pandas_user_guide_2_17.txt
5-01", .....: datetime.datetime(2013, 5, 1), .....: np.datetime64("2014-05-01"), .....: ] .....: In [190]: bday_egypt = pd.offsets.CustomBusinessDay( .....: holidays=holidays, .....: weekmask=weekmask_egypt, .....: ) .....: In [...
pandas_user_guide/pandas_user_guide_6_2.txt
andas.DataFrame") as well. See [ Sparse accessor ](../reference/frame.html#api-frame-sparse) for more. ## Sparse calculation # You can apply NumPy [ ufuncs ](https://numpy.org/doc/stable/reference/ufuncs.html) to [ ` arrays.SparseArray ` ](../reference/api/pandas.arrays.SparseArray.html#pandas.arrays.SparseArray ...
pandas_user_guide/howtospeeduppythonpa_143_0.txt
Our last and final way to evaluate this dataset is to use vectorization. We will call our dataset and apply the default reward being ‘bad_karma’ to the entire data frame. Then we will only check for those that satisfy our parameters using boolean indexing. Think of it like setting a true/false value for each row. If an...
pandas_user_guide/pandas_user_guide_27_30.txt
eference/api/pandas.MultiIndex.html#pandas.MultiIndex "pandas.MultiIndex") . These are used by default in [ ` DataFrame.to_json() ` ](../reference/api/pandas.DataFrame.to_json.html#pandas.DataFrame.to_json "pandas.DataFrame.to_json") to indicate missing values and the subsequent read cannot distinguish the intent. ...
pandas_user_guide/howtospeeduppythonpa_156_0.txt
#### Fueling Innovation with an Exxact Multi-GPU Server
pandas_user_guide/tutorialbasicvectori_15_0.txt
New to LinkedIn? [ Join now ](https://www.linkedin.com/signup/cold- join?session_redirect=%2Fpulse%2Ftutorial-basic-vectorization-pandas-iterrows- apply-duc-lai-trung-minh-75d4c%2F&trk=article-ssr-frontend-pulse_contextual- sign-in-modal_sign-in-modal_join-link)
pandas_user_guide/tutorialbasicvectori_61_0.txt
In conclusion, vectorization is the most efficient way to perform operations on Pandas DataFrames. It is faster and more concise compared to iterrows() and apply(). However, there may be cases where iterrows() or apply() are more appropriate, especially when dealing with complex operations that cannot be easily vectori...
pandas_user_guide/pandas_user_guide_25_6.txt
el > > File ~/work/pandas/pandas/pandas/core/indexes/base.py:4301, in > Index._raise_invalid_indexer(self, form, key, reraise) > 4299 if reraise is not lib.no_default: > 4300 raise TypeError(msg) from reraise > -> 4301 raise TypeError(msg) > > TypeError: cannot do slice indexing on Dat...
pandas_user_guide/tutorialbasicvectori_77_0.txt
[ 25 ](https://www.linkedin.com/signup/cold- join?session_redirect=%2Fpulse%2Ftutorial-basic-vectorization-pandas-iterrows- apply-duc-lai-trung-minh-75d4c%2F&trk=article-ssr-frontend-pulse_x-social- details_likes-count_social-actions-reactions) ` ` ` ` ` ` ` ` ` ` ` ` ` `
pandas_user_guide/tutorialbasicvectori_71_0.txt
Funny
pandas_user_guide/vectorizationinpanda_42_0.txt
import pandas as pd
pandas_user_guide/pandas_user_guide_24_7.txt
e/api/pandas.io.formats.style.Styler.map_index.html) (elementwise): accepts a function that takes a single value and returns a string with the CSS attribute-value pair. * [ .apply_index() ](../reference/api/pandas.io.formats.style.Styler.apply_index.html) (level-wise): accepts a function that takes a Series and re...
pandas_user_guide/howtospeeduppythonpa_66_0.txt
Sign up
pandas_user_guide/tutorialbasicvectori_12_0.txt
[ Forgot password? ](https://www.linkedin.com/uas/request-password- reset?trk=article-ssr-frontend-pulse_contextual-sign-in-modal_sign-in- modal_forgot_password) Sign in
pandas_user_guide/vectorizationinpanda_62_0.txt
Here’s the same addition operation using NumPy:
pandas_user_guide/tutorialbasicvectori_74_0.txt
* Copy * LinkedIn * Facebook * Twitter
pandas_user_guide/pandas_user_guide_27_64.txt
file. In [609]: df.to_feather("example.feather") Read from a feather file. In [610]: result = pd.read_feather("example.feather") In [611]: result Out[611]: a b c ... g h i 0 a 1 3 ... 2013-0...
pandas_user_guide/howtospeeduppythonpa_73_0.txt
##### Deep Learning
pandas_user_guide/vectorizationinpanda_17_0.txt
Oct 9, 2023
pandas_user_guide/vectorizationinpanda_102_0.txt
\--
pandas_user_guide/howtospeeduppythonpa_97_0.txt
#### SXM vs PCIe: GPUs Best for Training LLMs like GPT-4
pandas_user_guide/pandasvectorization_40_0.txt
**Tags:** [ pandas ](/tag_pandas)
pandas_user_guide/pandas_user_guide_27_71.txt
id Date Col_1 Col_2 Col_3 0 0 26 2010-10-18 X 27.50 True 1 1 42 2010-10-19 Y -12.50 False 2 2 63 2010-10-20 Z 5.73 True If needed you can explicitly specify a format string, or a dict of arguments to pass to [ ` pandas.to_datetime() ` ](../reference/api/...
pandas_user_guide/pandas_user_guide_27_4.txt
efault ` False ` . * If ` True ` -> try parsing the index. * If ` [1, 2, 3] ` -> try parsing columns 1, 2, 3 each as a separate date column. * If ` [[1, 3]] ` -> combine columns 1 and 3 and parse as a single date column. * If ` {'foo': [1, 3]} ` -> parse columns 1, 3 as date and call resu...
pandas_user_guide/pandasvectorization_29_0.txt
# you can use a pandas command too df.mean()
pandas_user_guide/pandas_user_guide_20_12.txt
df["B"], values=df["C"], aggfunc="sum") Out[117]: B 3 4 A 1 1.0 NaN 2 1.0 2.0 ### 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: In [118]: pd...
pandas_user_guide/pandas_user_guide_25_21.txt
ull numpy-like syntax: In [260]: df = pd.DataFrame(np.random.randint(n, size=(n, 3)), columns=list('abc')) In [261]: df Out[261]: a b c 0 7 8 9 1 1 0 7 2 2 7 2 3 6 2 2 4 2 6 3 5 3 8 2 6 1 7 2 7 5 1 5 8 9 8 0 9 1 5...
pandas_user_guide/pandas_user_guide_4_0.txt
Skip to main content __ Back to top __ ` Ctrl ` \+ ` K ` [ ![pandas 2.2.1 documentation - Home](../_static/pandas.svg) ](../index.html) Site Navigation * [ Getting started ](../getting_started/index.html) * [ User Guide ](index.html) * [ API reference ](../reference/index.html) * [ Development ](../develop...
pandas_user_guide/pandasvectorization_4_0.txt
# Vectorization Methods
pandas_user_guide/howtospeeduppythonpa_105_0.txt
[ ](https://twitter.com/intent/tweet?text=https://www.exxactcorp.com/blog/Deep- Learning/how-to-speed-up-python-pandas-by-over-300x)
pandas_user_guide/pandas_user_guide_5_1.txt
utes can be safely assigned to** ! In [7]: df[:2] Out[7]: A B C 2000-01-01 -0.173215 0.119209 -1.044236 2000-01-02 -0.861849 -2.104569 -0.494929 In [8]: df.columns = [x.lower() for x in df.columns] In [9]: df Out[9]: ...
pandas_user_guide/pandas_user_guide_24_9.txt
1, subset=slice_)\ .set_properties(**{'background-color': '#ffffb3'}, subset=slice_) [39]: | | c1 | c2 | c3 | c4 ---|---|---|---|---|--- A | r1 | -1.048553 | -1.420018 | -1.706270 | 1.950775 r2 | -0.509652 | -0.438074 | -1.252795 | 0.777490 B |...
pandas_user_guide/pandas_user_guide_25_29.txt
In [388]: dfd.loc[mask, 'c'] = 42 In [389]: dfd Out[389]: a c 0 one 42 1 one 42 2 two 2 3 three 3 4 two 4 5 one 42 6 six 6 # Setting a single item In [390]: dfd = dfc.copy() In [391]: dfd.loc[2, 'a'] = 11 ...
pandas_user_guide/pandas_user_guide_26_17.txt
g the offending groups, we can return a like- indexed objects where the groups that do not pass the filter are filled with NaNs. In [190]: dff.groupby("B").filter(lambda x: len(x) > 2, dropna=False) Out[190]: A B 0 NaN NaN 1 NaN NaN 2 2.0 b 3 3.0 b 4 4.0 ...
pandas_user_guide/pandas_user_guide_27_41.txt
<degrees_other/> <degrees_polygon>180.0</degrees_polygon> <sides_other/> <sides_polygon>3.0</sides_polygon> </row> </data> Write an XML with default namespace: In [419]: print(geom_df.to_xml(namespaces={"": "https://example.com"})) <?xml version='1.0' e...
pandas_user_guide/pandasvectorization_37_0.txt
df.applymap(lambda x: x >= 1)
pandas_user_guide/pandas_user_guide_25_25.txt
rows 0 1.295989 1 -2.366110 2 0.433306 3 2.154730 4 1.126818 Name: A, dtype: float64 ### Setting metadata # Indexes are “mostly immutable”, but it is possible to set and change their ` name ` attribute. You can use the ` rename ` , ` set_names ` to set these att...
pandas_user_guide/pandas_user_guide_27_11.txt
-01-27 19:00:00 1999-01-27 18:56:00 KORD ... 19:00:00 18:56:00 0.81 1 1999-01-27 20:00:00 1999-01-27 19:56:00 KORD ... 20:00:00 19:56:00 0.01 2 1999-01-27 21:00:00 1999-01-27 20:56:00 KORD ... 21:00:00 20:56:00 -0.59 3 1999-01-27 21:00:00 1999-01-27 21:18:00 KORD ... 21:00:00 21:18...
pandas_user_guide/pandas_user_guide_10_11.txt
](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") or matching the ` name ` attribute of the [ ` Series ` ](../reference/api/pandas.Series.html#pandas.Series "pandas.Series") . * As a ` str ` indicating which of the columns of plotting [ ` DataFrame ` ](../reference/api/pandas.DataFr...
pandas_user_guide/pandas_user_guide_25_28.txt
ut this code is handled differently: dfmi['one']['second'] = value # becomes dfmi.__getitem__('one').__setitem__('second', value) See that ` __getitem__ ` in there? Outside of simple cases, it’s very hard to predict whether it will return a view or a copy (it depends on the memory layout...
pandas_user_guide/howtospeeduppythonpa_75_0.txt
April 24, 2024 12 min read ](/blog/deep-learning/ollama-open-source-llms- anywhere)
pandas_user_guide/pandas_user_guide_25_27.txt
can assign a custom index to the ` index ` attribute: In [375]: df_idx = pd.DataFrame(range(4)) In [376]: df_idx.index = pd.Index([10, 20, 30, 40], name="a") In [377]: df_idx Out[377]: 0 a 10 0 20 1 30 2 40 3 ## Returning a view versus a...
pandas_user_guide/pandas_user_guide_24_14.txt
## Other Fun and Useful Stuff # Here are a few interesting examples. ### Widgets # ` Styler ` interacts pretty well with widgets. If you’re viewing this online instead of running the notebook yourself, you’re missing out on interactively adjusting the color palette. [62]: ...
pandas_user_guide/pandas_user_guide_27_18.txt
id1230 413.836124 184.375703 11916.8 id1948 502.953953 173.237159 12468.3 ` read_fwf ` supports the ` dtype ` parameter for specifying the types of parsed columns to be different from the inferred type. In [197]: pd.read_fwf("bar.csv", header=None, index_col=0).dtypes Out[197]: ...
pandas_user_guide/howtospeeduppythonpa_179_0.txt
python
pandas_user_guide/pandas_user_guide_24_1.txt
r labels, using [ .relabel_index() ](../reference/api/pandas.io.formats.style.Styler.relabel_index.html) * Hiding certain columns, the index and/or column headers, or index names, using [ .hide() ](../reference/api/pandas.io.formats.style.Styler.hide.html) * Concatenating similar DataFrames, using [ .concat() ...
pandas_user_guide/pandas_user_guide_22_6.txt
g as alignment is not disabled with ` join=None ` ): In [98]: v Out[98]: -1 z 0 a 1 b 3 d 4 e dtype: string In [99]: s.str.cat([v, u, u.to_numpy()], join="outer", na_rep="-") Out[99]: -1 -z-- 0 aaab 1 bbbd 2 c-c...
pandas_user_guide/howtospeeduppythonpa_153_0.txt
1. Use Built-in Pandas and NumPy Functions that have implemented C like ‘sum()’, ‘mean()’, or ‘max()’. 2. Use vectorized operations that can apply to entire DataFrames and Series including mathematical operations, comparisons, and logic to create a boolean mask to select multiple rows from your data set. 3. You can use...
pandas_user_guide/pandas_user_guide_22_7.txt
= pd.Series(["a1", "b2", "c3"], ["A11", "B22", "C33"], dtype="string") In [112]: s Out[112]: A11 a1 B22 b2 C33 c3 dtype: string In [113]: s.index.str.extract("(?P<letter>[a-zA-Z])", expand=True) Out[113]: letter 0 A 1 B 2 C It r...
pandas_user_guide/pandas_user_guide_27_25.txt
es; If ` True ` , then try to parse date-like columns, default is ` True ` . * ` keep_default_dates ` : boolean, default ` True ` . If parsing dates, then parse the default date-like columns. * ` precise_float ` : boolean, default ` False ` . Set to enable usage of higher precision (strtod) function when ...
pandas_user_guide/vectorizationinpanda_132_0.txt
Teams
pandas_user_guide/pandas_user_guide_7_8.txt
dth ` sets the maximum width of columns. Cells of this length or longer will be truncated with an ellipsis. In [52]: df = pd.DataFrame( ....: np.array( ....: [ ....: ["foo", "bar", "bim", "uncomfortably long string"], ....: ["horse", "cow",...
pandas_user_guide/pandas_user_guide_2_5.txt
imeIndex(['2012-10-08 18:15:05.100000', '2012-10-08 18:15:05.200000', '2012-10-08 18:15:05.300000', '2012-10-08 18:15:05.400000', '2012-10-08 18:15:05.500000'], dtype='datetime64[ns]', freq=None) Note The ` unit ` parameter does not use the same strings as...
pandas_user_guide/pandas_user_guide_11_8.txt
rformance improvements compared to standard Python syntax for large [ ` DataFrame ` ](../reference/api/pandas.DataFrame.html#pandas.DataFrame "pandas.DataFrame") . This engine requires the optional dependency ` numexpr ` to be installed. The ` 'python' ` engine is generally _not_ useful except for testing other eval...
pandas_user_guide/pandas_user_guide_26_19.txt
rue ` ). Show all values: In [210]: pd.Series([1, 1, 1]).groupby( .....: pd.Categorical(["a", "a", "a"], categories=["a", "b"]), observed=False .....: ).count() .....: Out[210]: a 3 b 0 dtype: int64 Show only the observed values: In ...