ladybug_pandas.dataframe module

class ladybug_pandas.dataframe.DataFrame(data_collections: List[Union[HourlyDiscontinuousCollection, HourlyContinuousCollection, DailyCollection, MonthlyCollection, MonthlyPerHourCollection]], name_key: Optional[str] = None, populate_metadata: bool = False, axis: int = 1)[source]

Bases: object

Generate a Dataframe from a list of ladybug data collections

Example

import ladybug_pandas as lbp
from ladybug.wea import Wea
from ladybug.location import Location

location = Location(
    city='Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch',
    state='Wales',
    country='United Kingdom',
    latitude=53.224622,
    longitude=-4.197995,
    time_zone=0
)

wea = Wea.from_ashrae_clear_sky(location=location)

df = lbp.DataFrame([
    wea.direct_normal_irradiance,
    wea.diffuse_horizontal_irradiance,
    wea.global_horizontal_irradiance,
    wea.direct_horizontal_irradiance,
])
Parameters:
  • {List[Union[HourlyDiscontinuousCollection (data_collections) –

  • HourlyContinuousCollection –

  • DailyCollection –

  • MonthlyCollection –

  • type (MonthlyPerHourCollection]]} -- A list of datacollections. Must all be of the same) –

Keyword Arguments:

(default (name_key {str} -- The name of the metadata key to use as a column name. Will default to datatype name if not specified) – {None})

Returns:

pd.DataFrame – A pandas dataframe. Each column will have a type of LadybugArrayType

classmethod from_epw(epw: EPW) → DataFrame[source]

Generate a Dataframe from an EPW object

Example

import ladybug_pandas as lbp
from ladybug.epw import EPW

epw_path = 'tests/assets/epw/tokyo.epw'

epw = EPW(epw_path)

df = lbp.DataFrame.from_epw(epw)
Parameters:

object (epw {EPW} -- A ladybug EPW) –

Returns:

pd.DataFrame – A pandas dataframe. Each column will have a type of LadybugArrayType