This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pyspark.sql.functions import array, col, explode, lit, struct | |
| from pyspark.sql import DataFrame | |
| from typing import Iterable | |
| def melt( | |
| df: DataFrame, | |
| id_vars: Iterable[str], value_vars: Iterable[str], | |
| var_name: str="variable", value_name: str="value") -> DataFrame: | |
| """Convert :class:`DataFrame` from wide to long format.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #notebook-container{ | |
| box-shadow: none !important; | |
| } | |
| .container { | |
| width: 80% !important; | |
| } | |
| .notebook_app { | |
| background: #fff !important; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def describe_numeric_1d(series: pd.Series, series_description: dict) -> dict: | |
| """Describe a numeric series. | |
| Args: | |
| series: The Series to describe. | |
| series_description: The dict containing the series description so far. | |
| Returns: | |
| A dict containing calculated series description values. | |
| Notes: | |
| When 'bins_type' is set to 'bayesian_blocks', astropy.stats.bayesian_blocks is used to determine the number of | |
| bins. Read the docs: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import appex | |
| import json | |
| import requests | |
| LANGUAGE = "en-gb" | |
| OXFORD_ID = "9acc1234" | |
| OXFORD_KEY = "6baccf388cd6456456326e85054f30aba" | |
| OXFORD_URL = "https://od-api.oxforddictionaries.com/api/v2" | |
| OXFORD_HEADERS = { | |
| "app_id": OXFORD_ID, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __author__ = 'Amal G Jose' | |
| from datetime import datetime | |
| from dateutil import relativedelta | |
| ##Aug 7 1989 8:10 pm | |
| date_1 = datetime(1989, 8, 7, 20, 10) | |
| ##Dec 5 1990 5:20 am | |
| date_2 = datetime(1990, 12, 5, 5, 20) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Highcharts CheatSheet Part 1. | |
| // Create interactive charts easily for your web projects. | |
| // Download: http://www.highcharts.com/download | |
| // More: http://api.highcharts.com/highcharts | |
| // 1. Installation. | |
| // Highcharts requires two files to run, highcharts.js and either jQuery, MooTools or Prototype or the Highcharts Standalone Framework which are used for some common JavaScript tasks. | |
| // <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
| // <script src="https://code.highcharts.com/highcharts.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # client object | |
| client = googlemaps.Client(key = "YOUR API") | |
| # most avaialable parameters | |
| all_fields = ['business_status', 'formatted_address','geometry/location','name', | |
| 'place_id', 'rating','types', 'user_ratings_total','formatted_phone_number'] | |
| # desirable parameters | |
| fields = ['place_id', 'name', 'formatted_address'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Because I couldn't get this to do what I wanted: | |
| # https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.compare.html | |
| import pandas as pd | |
| from typing import Optional, List | |
| def compare_dataframes(df1, df2, drop_indexes=False, ignore_columns: Optional[List]=None): | |
| '''Returns two dataframes: the rows that only show up in each dataframe''' | |
| if drop_indexes: | |
| df1 = df1.reset_index(drop=True) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder