From 6eb148e26d340c192dfa73c0a4d4cbdf33ebb1ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sun, 17 Sep 2023 13:33:18 +0200 Subject: [PATCH] CSV, Plotly --- README.md | 5 +++-- index.html | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dc2cfa8..adfa28a 100644 --- a/README.md +++ b/README.md @@ -1832,6 +1832,7 @@ import csv .writerows() # Appends multiple rows. ``` * **File must be opened with a `'newline=""'` argument, or '\r' will be added in front of every '\n' on platforms that use '\r\n' line endings!** +* **Open existing file with `'mode="w"'` to overwrite it or `'mode="a"'` to append to it.** ### Parameters * **`'dialect'` - Master parameter that sets the default values. String or a 'csv.Dialect' object.** @@ -3466,8 +3467,8 @@ def scrape_data(): return map(pd.Series.rename, out, ['Total Cases', 'Bitcoin', 'Gold', 'Dow Jones']) def wrangle_data(covid, bitcoin, gold, dow): - df = pd.concat([bitcoin, gold, dow], axis=1) # Joins columns on dates. - df = df.sort_index().interpolate() # Sorts by date and interpolates NaN-s. + df = pd.concat([bitcoin, gold, dow], axis=1) # Creates table by joining columns on dates. + df = df.sort_index().interpolate() # Sorts table by date and interpolates NaN-s. df = df.loc['2020-02-23':] # Discards rows before '2020-02-23'. df = (df / df.iloc[0]) * 100 # Calculates percentages relative to day 1. df = df.join(covid) # Adds column with covid cases. diff --git a/index.html b/index.html index d0db38a..2beb3a3 100644 --- a/index.html +++ b/index.html @@ -1526,6 +1526,7 @@ CompletedProcess(args=['bc', 'newline=""' argument, or '\r' will be added in front of every '\n' on platforms that use '\r\n' line endings! +
  • Open existing file with 'mode="w"' to overwrite it or 'mode="a"' to append to it.
  • Parameters

    • 'dialect' - Master parameter that sets the default values. String or a 'csv.Dialect' object.
    • @@ -2824,8 +2825,8 @@ ex.line(df, x='Date', y=return map(pd.Series.rename, out, ['Total Cases', 'Bitcoin', 'Gold', 'Dow Jones']) def wrangle_data(covid, bitcoin, gold, dow): - df = pd.concat([bitcoin, gold, dow], axis=1) # Joins columns on dates. - df = df.sort_index().interpolate() # Sorts by date and interpolates NaN-s. + df = pd.concat([bitcoin, gold, dow], axis=1) # Creates table by joining columns on dates. + df = df.sort_index().interpolate() # Sorts table by date and interpolates NaN-s. df = df.loc['2020-02-23':] # Discards rows before '2020-02-23'. df = (df / df.iloc[0]) * 100 # Calculates percentages relative to day 1. df = df.join(covid) # Adds column with covid cases.