12 Matching Annotations
  1. Jul 2024
    1. 0 1 4

      range can only do 1,2,3,etc.etc.

      geenrator is used one time (thats it u cant reuse) u cant use two functions that use the same generator for multiple uses, use a list (list is reusable)

    1. *args and **kwargs

      search up definition and difference

    2. Instead of running the file with the -i flag, y

      why does this need to be run with the i flag

    3. >>> first() 'Hi, I'm Elias' >>> second() 'Call me Ester'

      wait how is this possible

    1. Creating a DataFrame by passing a NumPy array with a datetime index using date_range() and labeled columns: In [5]: dates = pd.date_range("20130101", periods=6) In [6]: dates Out[6]: DatetimeIndex(['2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04', '2013-01-05', '2013-01-06'], dtype='datetime64[ns]', freq='D') In [7]: df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list("ABCD"))

      revisit this

    1. air_quality.head() Out[19]: date.utc location parameter value 2067 2019-05-07 01:00:00+00:00 London Westminster no2 23.0 1003 2019-05-07 01:00:00+00:00 FR04014 no2 25.0 100 2019-05-07 01:00:00+00:00 BETR801 pm25 12.5 1098 2019-05-07 01:00:00+00:00 BETR801 no2 50.5 1109 2019-05-07 01:00:00+00:00 London Westminster pm25 8.0 Copy to clipboard In [20]: air_quality = pd.merge(air_quality, stations_coord, how="left", on="location") In [21]: air_quality.head() Out[21]: date.utc ... coordinates.longitude 0 2019-05-07 01:00:00+00:00 ... -0.13193 1 2019-05-07 01:00:00+00:00 ... 2.39390 2 2019-05-07 01:00:00+00:00 ... 2.39390 3 2019-05-07 01:00:00+00:00 ... 4.43182 4 2019-05-07 01:00:00+00:00 ... 4.43182 [5 rows x 6 columns] Copy to clipboard Using the merge() function, for each of the rows in the air_quality table, the corresponding coordinates are added from the air_quality_stations_coord table. Both tables have the column location in common which is used as a key to combine the information. By choosing the left join, only the locations available in the air_quality (left) table, i.e. FR04014, BETR801 and London Westminster, end up in the resulting table. The merge function supports multiple join options similar to database-style operations.

      i dont understand any of this, not even the merge function. ask chatpgt

    2. Multi-indexing is out of scope for this pandas introduction. For the moment, remember that the function reset_index can be used to convert any level of an index to a column, e.g. air_quality.reset_index(level=0)

      what does this mean

    3. air_quality_ = pd.concat([air_quality_pm25, air_quality_no2], keys=["PM25", "NO2"])

      what is the purpose of the two keys?

    4. Sorting the table on the datetime information illustrates also the combination of both tables, with the parameter column defining the origin of the table (either no2 from table air_quality_no2 or pm25 from table air_quality_pm25): In [13]:

      i dont understand what changed

    1. When selecting specific rows and/or columns with loc or iloc, new values can be assigned to the selected data. For example, to assign the name anonymous to the first 3 elements of the fourth column: In [26]:

      this is confusing

    1. ith this in mind, let's build up a basic web font example from first principles. It's difficult to demonstrate this using an embedded live ex

      Is this entire exercise necessary lol I think i got the gist

    1. 1em is the font-size of an element (or the element’s parent if you’re using it to set font-size). So, for example, if an element’s font-size is 16px, then setting its width to 4em would make its width 64px (16 * 4 == 64). 1rem is the font-size of the root element (either :root or html). The math works the same with rem as it did with em

      Confused - whats the diff between 1em and 1rem (what do they mean by element's parent)

      what does root element mean

      Why do they multiply 16px by 4em?