From a238e85661b1fba9e44e4d4282e53076e2d6ecfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Fri, 15 Sep 2023 11:36:15 +0200 Subject: [PATCH] Pandas --- README.md | 6 +++--- index.html | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 50e5134..050e8de 100644 --- a/README.md +++ b/README.md @@ -1156,7 +1156,7 @@ class MySortable: ### Iterator * **Any object that has methods next() and iter() is an iterator.** -* **Next() should return next item or raise StopIteration.** +* **Next() should return next item or raise StopIteration exception.** * **Iter() should return 'self'.** ```python class Counter: @@ -3341,7 +3341,7 @@ plt.show() # Displays the plot. Also plt.sav ```python = pd.read_json/html('') # Run `$ pip3 install beautifulsoup4 lxml`. = pd.read_csv/pickle/excel('') # Use `sheet_name=None` to get all Excel sheets. - = pd.read_sql('', ) # Accepts SQLite3 or SQLAlchemy connection. + = pd.read_sql('
', ) # SQLite3/SQLAlchemy connection (see #SQLite). = pd.read_clipboard() # Reads a copied table from the clipboard. ``` @@ -3349,7 +3349,7 @@ plt.show() # Displays the plot. Also plt.sav = .to_dict(['d/l/s/…']) # Returns columns as dicts, lists or series. = .to_json/html/csv([]) # Also to_markdown/latex([]). .to_pickle/excel() # Run `$ pip3 install "pandas[excel]" odfpy`. -.to_sql('', ) # Accepts SQLite3 or SQLAlchemy connection. +.to_sql('', ) # Also `if_exists='fail/replace/append'`. ``` ### GroupBy diff --git a/index.html b/index.html index 70d0032..e60a8e3 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
- +
@@ -979,7 +979,7 @@ Z = dataclasses.make_dataclass('Z', [

Iterator

  • Any object that has methods next() and iter() is an iterator.
  • -
  • Next() should return next item or raise StopIteration.
  • +
  • Next() should return next item or raise StopIteration exception.
  • Iter() should return 'self'.
class Counter:
     def __init__(self):
@@ -2731,13 +2731,13 @@ plt.show()                                     # Disp
 
 
<DF> = pd.read_json/html('<str/path/url>')     # Run `$ pip3 install beautifulsoup4 lxml`.
 <DF> = pd.read_csv/pickle/excel('<path/url>')  # Use `sheet_name=None` to get all Excel sheets.
-<DF> = pd.read_sql('<table/query>', <conn.>)   # Accepts SQLite3 or SQLAlchemy connection.
+<DF> = pd.read_sql('<table/query>', <conn.>)   # SQLite3/SQLAlchemy connection (see #SQLite).
 <DF> = pd.read_clipboard()                     # Reads a copied table from the clipboard.
 
<dict> = <DF>.to_dict(['d/l/s/…'])             # Returns columns as dicts, lists or series.
 <str>  = <DF>.to_json/html/csv([<path>])       # Also to_markdown/latex([<path>]).
 <DF>.to_pickle/excel(<path>)                   # Run `$ pip3 install "pandas[excel]" odfpy`.
-<DF>.to_sql('<table_name>', <connection>)      # Accepts SQLite3 or SQLAlchemy connection.
+<DF>.to_sql('<table_name>', <connection>)      # Also `if_exists='fail/replace/append'`.
 

GroupBy

Object that groups together rows of a dataframe based on the value of the passed column.

>>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 6]], list('abc'), list('xyz'))
 >>> df.groupby('z').get_group(6)
@@ -2928,7 +2928,7 @@ $ deactivate                  # Deactivates the activ
  
 
   
- +