{"id":15651442,"url":"https://github.com/idouble/pandas-python-data-analysis-playground","last_synced_at":"2025-09-10T05:45:23.555Z","repository":{"id":130708649,"uuid":"169988643","full_name":"IDouble/Pandas-Python-Data-Analysis-Playground","owner":"IDouble","description":"🐍 Data Analysis with the Pandas Library \u0026 Notes 📊📈","archived":false,"fork":false,"pushed_at":"2024-02-29T16:58:38.000Z","size":9369,"stargazers_count":57,"open_issues_count":1,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-26T07:15:55.302Z","etag":null,"topics":["analysis","csv","csv-files","data","data-analysis","data-science","data-visualization","dataframe","examples","library","pandas","pandas-dataframe","pandas-library","pandas-python","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IDouble.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-02-10T14:46:38.000Z","updated_at":"2025-03-30T00:45:25.000Z","dependencies_parsed_at":"2024-04-08T23:12:41.625Z","dependency_job_id":null,"html_url":"https://github.com/IDouble/Pandas-Python-Data-Analysis-Playground","commit_stats":null,"previous_names":["idouble/pandas-python-data-analysis-playground"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDouble%2FPandas-Python-Data-Analysis-Playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDouble%2FPandas-Python-Data-Analysis-Playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDouble%2FPandas-Python-Data-Analysis-Playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDouble%2FPandas-Python-Data-Analysis-Playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IDouble","download_url":"https://codeload.github.com/IDouble/Pandas-Python-Data-Analysis-Playground/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251752537,"owners_count":21638132,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analysis","csv","csv-files","data","data-analysis","data-science","data-visualization","dataframe","examples","library","pandas","pandas-dataframe","pandas-library","pandas-python","python"],"created_at":"2024-10-03T12:38:28.815Z","updated_at":"2025-04-30T17:40:34.459Z","avatar_url":"https://github.com/IDouble.png","language":"Python","readme":"# 🐍 Pandas Python Data Analysis Playground 📊📈\n🐍 Data Analysis with the Pandas Library 📊📈\n\n## Installation Pandas ⬇️ \nThe easiest way to install Pandas is with pip. Type in your console:\n```\npip install pandas\n```\n\n## Load DataFrame from a CSV File 📂\nLoad a DateFrame from a CSV File. (Method .read_csv(\"your_csv_file.csv\"))\n```\nimport pandas as pd\n\ndf = pd.read_csv(\"new_york_city.csv\")\n```\n\n## Print Rows from a Dateframe using an Integer Index 🗃\nPrint 10 Rows from a Dateframe using an Integer Index from 10-20. (Method .iloc[from:to])\n```\n# Print 10 Rows from Dateframe with Integer Index from 10-20\nprint(df.iloc[10:20])\n```\n\n## Print the first Rows from a Dateframe 🗃\nPrint the first 10 Rows from a Dateframe. (Method .head(amount))\n```\n# Print the first 10 Rows from the Dateframe\nprint(df.head(10))\n```\n\n## Print Rows from a Dateframe and sort them with an attribute 🗃\nPrint 10 Rows from a Dateframe using an Integer Index from 0-10 and sort them with an attribute. (Method .sort_values([\"Start Time\"]))\n```\n# Prints the first 10 Rows, sorted by Start Time\nprint(df.iloc[0:10].sort_values([\"Start Time\"]))\n```\n\n## Print 10 random Rows from a Dateframe 🗃\nPrint 10 random Rows from a Dateframe. (Method .sample(amount))\n```\n# Print 10 random Rows from a Dateframe\nprint(df.sample(10))\n```\n\n## Create Data Frame 🗂\n```\n# Create data for the Data Frame\ndata = {'state': ['Ohio', 'Ohio', 'Ohio', 'Nevada', 'Nevada', 'Nevada'],\n        'year': [2000, 2001, 2002, 2001, 2002, 2003],\n        'pop': [1.5, 1.7, 3.6, 2.4, 2.9, 3.2]}\n\n# Create Data Frame\ndf = pd.DataFrame(data)\n```\n\n## Draw Candlestick Chart with moving averages 📈\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"1000\" src=\"Images/Chart_Draw_financial_Candlestick_Chart.png\"\u003e\n\u003c/p\u003e\n\n```\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport datetime\nfrom mpl_finance import candlestick_ohlc\nimport matplotlib.dates as mdates\n\ndf = pd.read_csv('candlestick_chart.csv')\n\n# ensuring only equity series is considered\ndf = df.loc[df['Series'] == 'EQ']\n\n# Converting date to pandas datetime format\ndf['Date'] = pd.to_datetime(df['Date'])\ndf[\"Date\"] = df[\"Date\"].apply(mdates.date2num)\n\n# Creating required data in new DataFrame OHLC\nohlc= df[['Date', 'Open Price', 'High Price', 'Low Price','Close Price']].copy()\n# In case you want to check for shorter timespan\n# ohlc =ohlc.tail(60)\n# ohlc['SMA50'] = ohlc[\"Close Price\"].rolling(50).mean()\n\nf1, ax = plt.subplots(figsize = (10,5))\n\n# plot the candlesticks\ncandlestick_ohlc(ax, ohlc.values, width=.6, colorup='green', colordown='red')\nax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m'))\n\n# Creating SMA columns\nohlc['SMA5'] = ohlc[\"Close Price\"].rolling(5).mean()\nohlc['SMA10'] = ohlc[\"Close Price\"].rolling(10).mean()\nohlc['SMA20'] = ohlc[\"Close Price\"].rolling(20).mean()\nohlc['SMA50'] = ohlc[\"Close Price\"].rolling(50).mean()\nohlc['SMA100'] = ohlc[\"Close Price\"].rolling(100).mean()\nohlc['SMA200'] = ohlc[\"Close Price\"].rolling(200).mean()\n\n# Plotting SMA columns\n# ax.plot(ohlc['Date'], ohlc['SMA5'], color = 'blue', label = 'SMA5')\n# ax.plot(ohlc['Date'], ohlc['SMA10'], color = 'blue', label = 'SMA10')\n# ax.plot(ohlc['Date'], ohlc['SMA20'], color = 'red', label = 'SMA20')\nax.plot(ohlc['Date'], ohlc['SMA50'], color = 'green', label = 'SMA50')\n# ax.plot(ohlc.index, df['SMA100'], color = 'blue', label = 'SMA100')\nax.plot(ohlc['Date'], ohlc['SMA200'], color = 'blue', label = 'SMA200')\n\nplt.show()\n```\n\n## Draw financial Chart 💹\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"640\" src=\"Images/Chart_Draw_financial_Chart.png\"\u003e\n\u003c/p\u003e\n\n```\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport matplotlib\nfrom datetime import datetime\n\nfig = plt.figure()\nax = fig.add_subplot(1, 1, 1)\n\ndata = pd.read_csv('spx.csv', index_col=0, parse_dates=True)\nspx = data['SPX']\n\nspx.plot(ax=ax, style='k-')\n\ncrisis_data = [\n    (datetime(2007, 10, 11), 'Peak of bull market'),\n    (datetime(2008, 3, 12), 'Bear Stearns Fails'),\n    (datetime(2008, 9, 15), 'Lehman Bankruptcy')\n]\n\nfor date, label in crisis_data:\n    ax.annotate(label, xy=(date, spx.asof(date) + 75),\n                xytext=(date, spx.asof(date) + 225),\n                arrowprops=dict(facecolor='black', headwidth=4, width=2,\n                                headlength=4),\n                horizontalalignment='left', verticalalignment='top')\n\n# Zoom in on 2007-2010\nax.set_xlim(['1/1/2007', '1/1/2011'])\nax.set_ylim([600, 1800])\n\nax.set_title('Important dates in the 2008-2009 financial crisis')\n\nfig.show()\n```\n\n![Binance Ready to give crypto a try ? buy bitcoin and other cryptocurrencies on binance](Images/binance.jpg)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidouble%2Fpandas-python-data-analysis-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidouble%2Fpandas-python-data-analysis-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidouble%2Fpandas-python-data-analysis-playground/lists"}