kandi background
Explore Kits

armeria | goto microservice framework

 by   line Java Version: armeria-1.15.0 License: Apache-2.0

 by   line Java Version: armeria-1.15.0 License: Apache-2.0

Download this library from

kandi X-RAY | armeria Summary

armeria is a Java library typically used in Web Services, Spring Boot applications. armeria has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub, Maven.
Build a reactive microservice at your pace, not theirs. Armeria is your go-to microservice framework for any situation. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard. It is open-sourced by the creator of Netty and his colleagues at LINE Corporation.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • armeria has a highly active ecosystem.
  • It has 3561 star(s) with 686 fork(s). There are 176 watchers for this library.
  • There were 2 major release(s) in the last 6 months.
  • There are 375 open issues and 1064 have been closed. On average issues are closed in 95 days. There are 29 open pull requests and 0 closed requests.
  • It has a negative sentiment in the developer community.
  • The latest version of armeria is armeria-1.15.0
armeria Support
Best in #Java
Average in #Java
armeria Support
Best in #Java
Average in #Java

quality kandi Quality

  • armeria has 0 bugs and 0 code smells.
armeria Quality
Best in #Java
Average in #Java
armeria Quality
Best in #Java
Average in #Java

securitySecurity

  • armeria has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • armeria code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
armeria Security
Best in #Java
Average in #Java
armeria Security
Best in #Java
Average in #Java

license License

  • armeria is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
armeria License
Best in #Java
Average in #Java
armeria License
Best in #Java
Average in #Java

buildReuse

  • armeria releases are available to install and integrate.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • armeria saves you 191465 person hours of effort in developing the same functionality from scratch.
  • It has 251963 lines of code, 22040 functions and 2708 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
armeria Reuse
Best in #Java
Average in #Java
armeria Reuse
Best in #Java
Average in #Java
Top functions reviewed by kandi - BETA

kandi has reviewed armeria and discovered the below as its top functions. This is intended to give you an instant insight into armeria implemented functionality, and help decide if they suit your requirements.

  • Handle a request .
  • Handles a request .
  • Build the complete URI .
  • Transform a glob pattern into a regex pattern .
  • Get validated assertion .
  • Get the web server .
  • Decodes unicode characters and encode them to bytes .
  • Aggregates the response .
  • Decode a UTF - 8 component .
  • Configures the given server with Armeria settings .

armeria Key Features

Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.

Add values from ferien-api and holidays library to pandas dataframe by date

copy iconCopydownload iconDownload
def add_externals():
geolocator = Nominatim(user_agent='plantgrid', timeout=3)
location = geolocator.geocode('Schulweg 23, 26203 Wardenburg')
federal_state = 'NI'
df = pd.DataFrame(pd.read_csv('Schachtschneider_further.csv', header=0)) # , index_col=0
print("----- Adding external data -----")
df['Auf. Datum'] = pd.to_datetime(df['Auf. Datum'])
df['Auf. Datum'] = df['Auf. Datum'].dt.date
df.index = df['Auf. Datum']
df = WeatherIngest.add_daily_weather_data(df=df, location=location)
df = CalendarIngest.add_public_holidays(df=df, federal_state=federal_state)
df = CalendarIngest.add_school_holidays(df=df, federal_state=federal_state)

def add_public_holidays(df: pd.DataFrame, federal_state: str):
    federal_state_holidays = holidays.CountryHoliday(country='Germany', prov=federal_state, years=[2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020])
    if 'public_holiday' not in df.columns:
        df['public_holiday'] = 'no'
    for date in df.index:
        if date in federal_state_holidays:
            df.at[date, 'public_holiday'] = federal_state_holidays[date]
    
    return df


def add_school_holidays(df: pd.DataFrame, federal_state: str): # , date: datetime.date
    for year in range(2001, 2021):
        federal_state_school_holidays = ferien.state_vacations(state_code=federal_state, year=year)
        if 'school_holiday' not in df.columns:
            df['school_holiday'] = 'no'
        index = df['Auf. Datum']
        for date in index:
            for vac in federal_state_school_holidays:
                if vac.start.date() <= date <= vac.end.date():
                    df.at[date, 'school_holiday'] = vac.name
                
    return df

Right way to add a per-request response delay to a custom HttpService

copy iconCopydownload iconDownload
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
    return HttpResponse.delayed(
        HttpResponse.of(200),
        Duration.ofSeconds(3),
        ctx.eventLoop());
}
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
    return HttpResponse.from(req.aggregate().thenApply(ahr -> {
    //                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        MyResponse myResponse = Utils.handle(ahr);
        HttpResponse httpResponse = Utils.toResponse(myResponse);
        Duration myDelay = Utils.delayMillis(...);
        return HttpResponse.delayed(httpResponse, myDelay, ctx.eventLoop());
        //                  ^^^^^^^
    });
}
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
    return HttpResponse.from(req.aggregate().thenCompose(ahr -> {
    //                                       ^^^^^^^^^^^
        My1stResponse my1stRes = Utils.handle(ahr);

        // Schedule some asynchronous task that returns another future.
        CompletableFuture<My2ndResponse> myFuture = doSomething(my1stRes);

        // Map the future into an HttpResponse.
        return myFuture.thenApply(my2ndRes -> {
            HttpResponse httpRes = Utils.toResponse(my1stRes, my2ndRes);
            return httpRes;
        });
    });
}
-----------------------
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
    return HttpResponse.delayed(
        HttpResponse.of(200),
        Duration.ofSeconds(3),
        ctx.eventLoop());
}
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
    return HttpResponse.from(req.aggregate().thenApply(ahr -> {
    //                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        MyResponse myResponse = Utils.handle(ahr);
        HttpResponse httpResponse = Utils.toResponse(myResponse);
        Duration myDelay = Utils.delayMillis(...);
        return HttpResponse.delayed(httpResponse, myDelay, ctx.eventLoop());
        //                  ^^^^^^^
    });
}
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
    return HttpResponse.from(req.aggregate().thenCompose(ahr -> {
    //                                       ^^^^^^^^^^^
        My1stResponse my1stRes = Utils.handle(ahr);

        // Schedule some asynchronous task that returns another future.
        CompletableFuture<My2ndResponse> myFuture = doSomething(my1stRes);

        // Map the future into an HttpResponse.
        return myFuture.thenApply(my2ndRes -> {
            HttpResponse httpRes = Utils.toResponse(my1stRes, my2ndRes);
            return httpRes;
        });
    });
}
-----------------------
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
    return HttpResponse.delayed(
        HttpResponse.of(200),
        Duration.ofSeconds(3),
        ctx.eventLoop());
}
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
    return HttpResponse.from(req.aggregate().thenApply(ahr -> {
    //                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        MyResponse myResponse = Utils.handle(ahr);
        HttpResponse httpResponse = Utils.toResponse(myResponse);
        Duration myDelay = Utils.delayMillis(...);
        return HttpResponse.delayed(httpResponse, myDelay, ctx.eventLoop());
        //                  ^^^^^^^
    });
}
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
    return HttpResponse.from(req.aggregate().thenCompose(ahr -> {
    //                                       ^^^^^^^^^^^
        My1stResponse my1stRes = Utils.handle(ahr);

        // Schedule some asynchronous task that returns another future.
        CompletableFuture<My2ndResponse> myFuture = doSomething(my1stRes);

        // Map the future into an HttpResponse.
        return myFuture.thenApply(my2ndRes -> {
            HttpResponse httpRes = Utils.toResponse(my1stRes, my2ndRes);
            return httpRes;
        });
    });
}

Accessing response headers using a decorator in Armeria

copy iconCopydownload iconDownload
builder.decorator(delegate, ctx, req) -> {
    final HttpResponse res = delegate.serve(ctx, req);
    return HttpResponse.from(res.aggregate().thenApply(r -> {
        final ResponseHeaders headers = r.headers();
        if (headers...) {
            throw new IllegalArgumentException();
        }
        // Convert AggregatedHttpResponse back to HttpResponse.
        return r.toHttpResponse();
    }));
});
builder.decorator(delegate, ctx, req) -> {
    final HttpResponse res = delegate.serve(ctx, req);
    return new FilteredHttpResponse(res) {
        @Override
        public HttpObject filter(HttpObject obj) {
            // Ignore other objects like HttpData.
            if (!(obj instanceof ResponseHeaders)) {
                return obj;
            }

            final ResponseHeaders headers = (ResponseHeaders) obj;
            if (headers...) {
                throw new IllegalArgumentException();
            }

            return obj;
        }
    };
});
-----------------------
builder.decorator(delegate, ctx, req) -> {
    final HttpResponse res = delegate.serve(ctx, req);
    return HttpResponse.from(res.aggregate().thenApply(r -> {
        final ResponseHeaders headers = r.headers();
        if (headers...) {
            throw new IllegalArgumentException();
        }
        // Convert AggregatedHttpResponse back to HttpResponse.
        return r.toHttpResponse();
    }));
});
builder.decorator(delegate, ctx, req) -> {
    final HttpResponse res = delegate.serve(ctx, req);
    return new FilteredHttpResponse(res) {
        @Override
        public HttpObject filter(HttpObject obj) {
            // Ignore other objects like HttpData.
            if (!(obj instanceof ResponseHeaders)) {
                return obj;
            }

            final ResponseHeaders headers = (ResponseHeaders) obj;
            if (headers...) {
                throw new IllegalArgumentException();
            }

            return obj;
        }
    };
});

Armeria HTTP Client - how to add query string parameters

copy iconCopydownload iconDownload
// You don't really need a Map to build a QueryParams.
// See QueryParams.of() or QueryParamsBuilder.add() for more information.
Map<String, String> paramMap = ...;
QueryParams params =
    QueryParams.builder()
               .add(paramMap)
               .build();

WebClient client =
    WebClient.builder("http://example.com")
             .decorator(...)
             .build();

AggregatedHttpResponse res =
    client.get("/foo?" + params.toQueryString()).aggregate().join()

Using third party http client on Armeria

copy iconCopydownload iconDownload
Server server = Server
    .builder()
    .service("/", (ctx, req) -> {
        CompletableFuture<String> f1 = CompletableFuture.supplyAsync(() -> {
            // Perform some blocking operations that return a string.
        }, ctx.blockingTaskExecutor());

        CompletableFuture<String> f2 = f1.thenApply(result -> {
            // Transform the result into an HttpResponse.
            return HttpResponse.of("Result: %s", result);
        });

        return HttpResponse.from(f2);
    })
    .build();

Armeria WebClient request with connection factory and Req header

copy iconCopydownload iconDownload
  RequestHeaders header = RequestHeaders.of(HttpMethod.GET, endpoint, HttpHeaderNames.COOKIE,
            cookieHeader);
    WebClient.of(clientFactory(), hosturl)
    .execute(header)
    .aggregate()
    .whenCompleteAsync((resp,cause)->{
        if(cause != null) {
           //TODO
        }
        else if(resp.status()==HttpStatus.OK) {
            //TODO
        }
        else
        {
            //TODO
        }


    });




 public static ClientFactory clientFactory() {

    return ClientFactory.builder().sslContextCustomizer(b -> b.trustManager(InsecureTrustManagerFactory.INSTANCE))
            .idleTimeout(Duration.ZERO).build();
}

Problem to access Deployment with service

copy iconCopydownload iconDownload
>> kubectl get deployment zipkin 
NAME READY UP-TO-DATE AVAILABLE AGE 
zipkin 0/1 1 0 14m

Understanding Decorators in Armeria

copy iconCopydownload iconDownload
@Override
public HttpResponse serve(HttpService delegate, ServiceRequestContext ctx, HttpRequest req) {
  ... // setup session for the request context
  HttpResponse response = delegate.serve(ctx, req);
  response.whenComplete().handle((unused1, unused2) -> {
      ... // close session
  });
  return response;
}

Reorganizing dataset for List Length Analysis in R

copy iconCopydownload iconDownload
library(dplyr)
library(tidyr)
df1 %>% 
    mutate(PA = 1) %>%
    group_by(species, site) %>%
    complete(year = unique(df1$year)) %>%
    mutate(PA =  replace_na(PA, 0))

Bootstrap Hibernate SessionFactory in Netty/Armeria handler method fails with ClassNotFoundException

copy iconCopydownload iconDownload
public class MyService {
    @Get("/start")
    public HttpResponse start() throws Exception {
        final StandardServiceRegistryBuilder registryBuilder =
            new StandardServiceRegistryBuilder().configure();
        ...
    }
}
    @Get("/start")
    public HttpResponse start() throws Exception {
        Thread.currentThread().setContextClassLoader(MyService.class.getClassLoader());
        // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        final StandardServiceRegistryBuilder registryBuilder =
            new StandardServiceRegistryBuilder().configure();
        ...
    }
-----------------------
public class MyService {
    @Get("/start")
    public HttpResponse start() throws Exception {
        final StandardServiceRegistryBuilder registryBuilder =
            new StandardServiceRegistryBuilder().configure();
        ...
    }
}
    @Get("/start")
    public HttpResponse start() throws Exception {
        Thread.currentThread().setContextClassLoader(MyService.class.getClassLoader());
        // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        final StandardServiceRegistryBuilder registryBuilder =
            new StandardServiceRegistryBuilder().configure();
        ...
    }

Community Discussions

Trending Discussions on armeria
  • Add values from ferien-api and holidays library to pandas dataframe by date
  • Right way to add a per-request response delay to a custom HttpService
  • HTTP to HTTPS proxy CONNECT handling - porting code from Netty to Armeria
  • disallowing a particular http method
  • Accessing response headers using a decorator in Armeria
  • Armeria HTTP Client - how to add query string parameters
  • How to call multiple service?
  • Using third party http client on Armeria
  • Armeria WebClient request with connection factory and Req header
  • Problem to access Deployment with service
Trending Discussions on armeria

QUESTION

Add values from ferien-api and holidays library to pandas dataframe by date

Asked 2021-Oct-27 at 14:40

I want to insert vacation and holiday dates to my pandas dataframe but can't figure out how... Something doesn't work out with the dates of my dataframe and the dates from the ferien-api and the holidays library. Here is my code:

import pandas as pd
from geopy.geocoders import Nominatim

def add_externals():
    geolocator = Nominatim(user_agent="plantgrid", timeout=3)
    location = geolocator.geocode("Schulweg 23, 26203 Wardenburg")
    federal_state = "NI"
    df = pd.DataFrame(pd.read_csv("Schachtschneider_further.csv", header=0))
    print("----- Adding external data -----")
    df["Auf. Datum"] = pd.to_datetime(df["Auf. Datum"])
    df.index = df["Auf. Datum"].dt.date
    df = WeatherIngest.add_daily_weather_data(df=df, location=location)
    df = CalendarIngest.add_public_holidays(df=df, federal_state=federal_state)
    df = CalendarIngest.add_school_holidays(df=df, federal_state=federal_state)
    df.to_csv("Schachtschneider_externals.csv")

The add_public_holidays function:

import pandas as pd
import holidays

def add_public_holidays(df: pd.DataFrame, federal_state: str):
    federal_state_holidays = holidays.CountryHoliday(country='Germany', prov=federal_state, years=[2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020])
    if 'public_holiday' not in df.columns:
        df['public_holiday'] = 'no'
    for date in df.index:
        if date in federal_state_holidays:
            df.loc[date, 'public_holiday'] = federal_state_holidays[date]
    
    return df

And the add_school_holidays:

import pandas as pd
import ferien

def add_school_holidays(df: pd.DataFrame, federal_state: str): 
    for year in range(2001, 2021):
        federal_state_school_holidays = ferien.state_vacations(state_code=federal_state, year=year)
        if 'school_holiday' not in df.columns:
            df['school_holiday'] = 'no'
        for date in df.index:
            print(date)
            for vac in federal_state_school_holidays:
                if vac.start.date() <= date <= vac.end.date():
                    df.at[date, 'school_holiday'] = vac.name
                
    return df

The add_daily_weather_data function with the calc_daily_mean_weather_values function:

import pandas as pd
from datetime import datetime
from geopy.location import Location
from wetterdienst.provider.dwd.observation import DwdObservationRequest, DwdObservationPeriod, DwdObservationResolution, DwdObservationParameter, DwdObservationDataset
from dwdweather import DwdWeather

def calc_daily_mean_weather_values(location: Location) -> pd.Series:
    request = DwdObservationRequest(parameter = DwdObservationDataset.CLIMATE_SUMMARY,
                                         resolution=DwdObservationResolution.DAILY, 
                                         period=DwdObservationPeriod.HISTORICAL, start_date=datetime(2001, 1, 11), 
                                         end_date=datetime(2020, 10, 28), tidy=True, humanize=True, 
                                         si_units=True).filter_by_station_id(station_id=[963])
    df = request.values.all().df
    
    return df


def add_daily_weather_data(df: pd.DataFrame, location: Location):
    daily_mean_weather_values = calc_daily_mean_weather_values(location=location)
    
    temperature = daily_mean_weather_values.loc[daily_mean_weather_values['parameter'] == 'temperature_air_200']
    temperature_values = temperature['value'].to_list()
    temperature_values = [x - 273.15 for x in temperature_values]
    df['mean_temp'] = temperature_values
    
    humidity = daily_mean_weather_values.loc[daily_mean_weather_values['parameter'] == 'humidity']
    humidity_values = humidity['value'].to_list()
    df['mean_humid'] = humidity_values
        
    precipitation_height = daily_mean_weather_values.loc[daily_mean_weather_values['parameter'] == 'precipitation_height']
    precipitation_height_values = precipitation_height['value'].to_list()
    df['mean_prec_height_mm'] = precipitation_height_values
    df['total_prec_height_mm'] = [x * 24 for x in precipitation_height_values]
    
    sunshine_duration = daily_mean_weather_values.loc[daily_mean_weather_values['parameter'] == 'sunshine_duration']
    sunshine_duration_values = sunshine_duration['value'].to_list()
    df['mean_sun_dur_min'] = sunshine_duration_values
    df['total_sun_dur_h'] = [x * 24 / 60 for x in sunshine_duration_values] 
    
    return df

I'm trying around for really long now but do not come to a conclusion. Maybe someone already had a similar project and knows how to help me.

The problem is that the dates from the pandas dataframe and the dates from the ferien-api or holidays library, respectively, aren't from the same datatype and don't recognize each other, that's why I receive a data frame with two dates/ two index ('Auf. Datum'):

Auf. Datum,Auf. Datum,Acaena,Acantholimon,Acanthus,Acer palmatum,Aceriphyllum,Achillea,Achnatherum,Acinos,Aconitum,Aconogonon,Acorus,Actaea,Adenophora,Adiantum,Adonis,Aegopodium,Aethionema,Agapanthus,Agastache,Agrimonia,Ajania,Ajuga,Akebia,Alcalthaea,Alcea,Alchemilla,Alisma,Alliaria,Allium,Alopecurus,Aloysia,Alstroemeria,Althaea,Alyssum,Amelanchier,Ammophila,Amorpha,Amsonia,Anacyclus,Ananassalbei,Anaphalis,Anchusa,Andropogon,Androsace,Anemone,Anemonopsis,Anethum,Angelica,Anisodontea,Annemona,Antennaria,Anthemis,Anthericum,Anthoxanthum,Anthriscus,Anthyllis,Apfel,Apfelquitte,Aponogeton,Aquilegia,Arabis,Aralia,Arctanthemum,Arctostaphylos,Arenaria,Arisaema,Aristolochia,Armeria,Armoracia,Arnica,Aronia,Arrhenatherum,Artemisia,Arum,Aruncus,Arundo,Asarum,Asclepia,Asparagus,Asperula,Asphodeline,Asphodelus,Asplenium,Aster,Astilbe,Astilboides,Astrantia,Athyrium,Atropa,Aubrieta,Avena,Azolla,Azorella,BLumenzwiebeln,Bacopa,Baerenklau 'White Lips',Baldellia ranunculoides,Ballota,Baptisia,Barbarea,Basilikum,Begonia,Belamcanda chinensis,Berberis,Bergenia,Bergprimel,Berkleya purpurea,Beta,Bigelowia nutallii,Birne,Birnenquitte h,Bistorta,Blechnum,Bletilla,Bluetenschleier,Bluetenwoge,Blumenzwiebel,Blutwurz 'Plenum',Boehmeria sieboldiana,Boltonia,Borago,Bouteloua,Brassica,Briza,Brombeere,Brunnera,Bryonia,Buddleja,Buglossoides,Buphthalmum,Butomus,Buxus,Calamagrostis,Calamintha,Calceolaria,Calendula,Calla,Callitriche,Caltha,Camassia,Campanula,Canna,Capsicum frutescens,Cardamine,Cardiocrinum,Carduncellus,Carex,Carlina,Carpinus,Carum,Caryopteris,Catananche,Centaurea,Centaurium,Centranthus,Cephalaria,Cerastium,Ceratophyllum,Ceratostigma,Ceterach officinarum,Chaenarrhinum,Chamaemelum,Chamomilla recutita,Chasmanthium,Cheilanthes lanosa,Cheiranthus cheiri,Chelidonium,Chelone,Chenopodium,Chiastophyllum,Chionodoxa,Chrypogon gryllos,Chrysanthemum,Cichorium,Cimicifuga,Cirsium,Cistus,Claytonia sibirica,Clematis,Cochlearia officinalis,Codonopsis,Colchicum,Colocasia,Convallaria,Convolvulus,Cordyline,Coreopsis,Coriandrum,Cornus,Coronilla varia,Cortaderia,Cortusa matthioli,Corydalis,Coryllus,Cosmos,Cotoneatser,Cotula,Crambe,Crassula,Crataegus,Crepis biennis,Crinum,Crocosmia,Crocus,Cryptotaenia japonica 'Atropurpurea',Cychorium instibus 'Wegwarte',Cyclamen,Cymbalaria,Cymbopogon,Cynara,Cynoglossum,Cyperus,Cypripedium,Cyrtomium,Cystopteris,Cytisus,Dachgartenstauden,Dactylorhiza,Dahlia,Dalina,Darmera,Datisca cannabina,Daucus,Delosperma,Delphinium,Dendranthema,Deschampsia,Dianthus,Diascia,Dicentra,Dicksonia,Dictamnus,Dierama pulcherimum,Diervilla,Digiplexis,Digitalis,Dionaea,Diplotaxis tenuifolia her,Dipsacus,Disporum flavens,Dodecatheon,Doronicum,Draba,Dracocephalum,Drosera,Dryas,Dryopteris,Duchesnea indica,Echinacea,Echinops,Echium,Edelweiss,Edraianthus graminifolius,Eichhornia,Eleocharis,Elodea,Epilobium,Epimedium,Epipactis,Equisetum,Eragrostis,Eranthis hyemalis,Eremurus,Erigeron,Erinus,Eriocephalus africanus,Eriophorum,Eriophyllum,Erodium,Eryngium,Erysimum,Erythronium,Eucalyptus,Eucomis,Euonymus,Eupatorium,Euphorbia,Exotischer Bluetensaum,Fallopia,Farn,Festuca,Filipendula,Foeniculum,Fontinalis,Forsythia,Fragaria,Francoa sonchifolia varsonchifoliahne Bil,Freiland-Orchidee 'Formosana',Fritillaria,Fruehlingsstauden,Fuchsia,Funkie,Gaillardia,Galanthus nivalis ssp nivaliswiebel,Galega,Galium,Galtonia,Gartenaurikel rot,Gaura,Genista sagittalis,Gentiana,Geranium,Geum,Gillenia,Gladiolus,Glechoma,Globularia,Glyceria,Glycyrrhiza,Goniolimon,Graeser in Sorten,Gratiola officinalis,Gunnera,Gymnocarpium dryopteris,Gynostemma,Gypsophila,Hakonechloa,Halimiocistus,Hamamelis,Haplopappus lyalii,Hauswurz,Havelschwan 'Yellow Satellit',Hedera,Heimischer Bluetensaum,Helenium,Helianthemum,Helianthus,Helichrysum,Helictotrichon,Heliopsis,Helleborus,Helonias bullata,Hemerocallis,Hepatica,Heracium aurantiacum,Herbstanemonen rot,Herbstenzian,Herniaria,Hesperis,Heuchea,Heuchera,Heucherella,Hibiscus,Hieracium,Himbeeren,Hippuris,Hohe,Holcus,Honigsalbei,Horminum,Hosta,Hottonia,Houttuynia,Humulus,Hutchinsia,Hyacinthoides,Hyacinthus multiflorawiebel,Hydrangea,Hydrocharis,Hylomecon,Hypericum,Hyssopus,Hystripatula,Iberis,Ilex,Imperata,Incarvillea,Indigofera,Indocalamus tesselatus,Inula,Ipheion uniflorum,Ipomoea,Iris,Isatis tinctoria,Isolepis cernua,Isotoma,Jasione,Jeffersonia,Johannisbeere,Josta B,Jovibarba,Juglans,Juncus,Kakteen winterhart,Kalimeris,Kamille,Kirengeshoma,Kissenprimel,Kletter-Erdbeere,Knautia,Kniphofia,Knoblaurauke,Koeleria,Kraeuter,Kreuzknabenkraut,Kuklturheidelbeeren i S /,Lageubrieta cultorum blau,Lamium,Lathyrus,Laurus,Lavandula,Lavatera,Ledum,Lemna,Leontopodium,Leonurus,Leptodermis,Leucanth,Leucojum,Leucosceptrum japonicum 'Goldenngel',Levisticum,Lewisia,Leycesteria formosa,Leymus,Liatris,Libertia ixioides 'Goldfinger',Lichtspieler,Ligularia,Ligusticum,Ligustrum,Lilium,Limonium,Linaria,Linum,Lionorus cardiaca,Lippia,Liriope,Lithodora,Lithospermum purpur,Lobelia,Lonicera,Lotos,Lunaria,Lupinen in Sorten Jgw,Lupinen versch Sorten bluehend,Lupinus,Luronium natans,Luzula,Lychnis,Lycium,Lycopus europaeus,Lysichiton,Lysimachia,Lythrum,Macleaya,Maianthemum,Majoran,Malva,Mandragora (Alraune),Margeriten Ester Red,Mariendistel,Mariubium vulgare,Marrubium,Marsilea quadrifolia,Matricaria,Matteuccia,Mazus,Meconopsis,Melica,Melissa,Melittis,Mentha,Menyanthes,Mertensia,Meum,Micromeria,Milium,Millium,Mimulus,Misc Littleebra JGW,Miscanthus,Mitchella repens,Mix-CC mit  Solis im,Molinia,Monarda,Montia,Moorsegge,Morina longifolia,Muehlenbeckia,Muhlenbergia capillaris,Mukdenia,Mukgenia,Musa,Muscari,Myosotis,Myriophyllum,Myrrhis,Myrthis odorata,Narcissus,Narthecium ossifragum,Nasturtium,Nelkenwurz,Nelumbo,Neopaxia,Nepeta,Neuseelaenderflachs,Nierembergia repens,Nitella flexibilis,Nuphar,Nymphaea,Nymphoides,Ocimum,Oenanthe,Oenothera,Omphalodes,Onoclea,Ononis spinosa,Onopordum,Ophiopogon,Ophrys sphegodes incubacea,Opuntia,Orchidee,Orchis,Origano,Ornithogalum umbellatum,Orontium aquaticum,Osmunda,Oxalis,Pachyphragma macrophylla,Pachysandra,Paeonia,Paeonie,Paniculata,Panicum,Papaver,Paradisea liliastrum,Paris quadrifolia,Parnassia palustris,Paronychia kapela ssp serpyllifolia,Parthenium integrifolium,Parthenocissus var engelmannii,Patrinia scabiosifolia,Paulowuia tomentosa,Pelargonium endlicherianum,Peltiphyllum peltatum,Pennisetum,Penstemon,Perovskia,Persicaria,Petasites,Petrorhagia,Petroselinum,Peucedanum,Phalaris,Philadelphus,Phlox,Pholipullus  Maiapfel,Phormium,Phragmites,Phuopsis,Phygelius,Phyla,Phyllitis,Physalis,Physocarpus,Physostegia,Phyteuma,Phytolacca,Pilularia globulifera,Pimpinella,Pinellia ternata,Pistia,Plantago lanceolata,Platycodon,Pleioblastus,Pleione,Poa,Podophyllum,Polemonium,Polygala,Polygonatum,Polygonum,Polypodium,Polystichum,Pontederia,Potamogeton,Potentilla,Pratia,Preslia,Primula,Prizelago,Prizelago alpina 'Icecube',Prizelago alpina sspalpina,Prunella,Prunus l Herbergii,Pseudofumaria alba,Pseudolysimachion,Pseudosasa,Pteridium,Pulmonaria,Pulsatilla,Puschkinia scilloideswiebel,Pycanthemum,Pycnanthemum,Quellmoos lose,Rabdosia longituba,Ramonda,Ranunculus,Raoulia australis,Ratibida,Reseda lutea,Reynoutria,Rhababer The Sutton,Rhabarber,Rhadiola rosea,Rheum,Rhodiola rosea,Rhodohypoxis,Rhodoxis,Rispengras,Robinia,Rodgersia,Romneya,Rosa,Roscoea,Rose,Rosmarin,Rosularia aizoon,Rudbeckia,Rumeabtusofilius,Rumeacetosa,Rumeofficinalis,Rumerugosus,Rumesanguineus,Rumescutataus,Rumescutatus,Rungia,Ruta,Saccharum (Erianthus) ravennae,Sagina,Sagittaria,Salbei,Salicaprea,Salielegantissima /,Salvia,Salvinia,Sambucus,Sanguinaria,Sanguisorba,Santolina,Saponaria,Sarracenia,Saruma henryi,Sasa,Satureja,Saururus,Saxifraga,Scabiosa,Schattentraeumer,Schizachyrium,Schizostylis coccinea,Schleierkraut kriechend,Schoenoplectus,Scilla,Scirpus,Scleranthus uniflorus,Scrophularia macrantha 'Cardinal Red',Scutellaria,Sedoro,Sedum,Seerose rosa  groesseres Exemplar,Seidenmohn aubergine-farbig,Selaginella helvetica,Selinum,Semiaquilegia ecalcarata,Sempervivella,Sempervivium,Sempervivum,Senecio,Serratula tinctoria,Seseli,Sesleria,Setcracea hirsuta 'Swifttale',Sidalcea,Sideritis,Silbersommer,Silberwurz,Silene,Silinum walichianum,Silphium,Silybum,Sinarundinaria   Jumbo (U),Sisyrinchium,Smilacina,Solanum,Soldanella,Solidago,Solidora,Solitaer,Sommerenzian,Sommernachtstraum,Sonnenhut schwarz/dunkel,Sorghastrum,SparMixCC,Sparganium,Spartina,Sphaeralcea ambigua 'Childerley',Sphagnum,Spilanthes 'Peek-A-Boo',Spiraea,Spodiopogon,Sporobolus,Stachelbeere,Stachys,Stauden,Steingartenstauden,Stellaria,Stengelloser Enzian,Stephanandra,Stevia,Stipa,Stokesia,Stratiotes,Stratoides,Strobelianthes,Strobilanthes atropurpureus,Succisa pratensis,Suesskirsche,Suessklee,Symphyandra pendula,Symphytum,Syringa,Tagetes,Tanacetum,Taraxacum pseudoroseum,Taxus,Telekia,Tellima,Telypteris palustris,Teppichsedum,Tetrapanapapyrifera 'Rex',Teucrium,Thalictrum,Thelypteris palustris,Thermopsis,Thymian,Thymus,Tiarella,Topinambour,Townsendia rothrockii,Trachystemon,Tradescantia,Traenendes Herz,Trapa,Tray,Trays,Tricyrtis,Trifolium,Trillium,Trollius,Tropaeolum,Tulipa,Tussilago farfara,Typha,Uncinia,Unicinia 'Rubra',Utricularia,Uvularia,Vaccinium myrtillus,Valeriana,Vancouveria hexandra,Veratrum,Verbascum,Verbena,Vernonia,Veronica,Viburnum,Vinca,Viola,Wahlenbergia albomarginata,Waldsteinia,Wasserhahnenfuss,Weigela,Weinrebe C /,Wisteria sinensis  /,Woodsia,Wulfenia carinthiaca,Yucca,Zantedeschia,Zigadenus elegans,Zitronemelisse gelb/bunt,Zitronenverbene,Zizania,mean_temp,mean_humid,mean_prec_height_mm,total_prec_height_mm,mean_sun_dur_min,total_sun_dur_h,public_holiday,school_holiday
2001-01-12,2001-01-12,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0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,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-1.0,97.0,0.0,0.0,0.0,0.0,no,no

ANSWER

Answered 2021-Oct-27 at 14:40

I solved my problem by changing every date object to datetime.date.

def add_externals():
geolocator = Nominatim(user_agent='plantgrid', timeout=3)
location = geolocator.geocode('Schulweg 23, 26203 Wardenburg')
federal_state = 'NI'
df = pd.DataFrame(pd.read_csv('Schachtschneider_further.csv', header=0)) # , index_col=0
print("----- Adding external data -----")
df['Auf. Datum'] = pd.to_datetime(df['Auf. Datum'])
df['Auf. Datum'] = df['Auf. Datum'].dt.date
df.index = df['Auf. Datum']
df = WeatherIngest.add_daily_weather_data(df=df, location=location)
df = CalendarIngest.add_public_holidays(df=df, federal_state=federal_state)
df = CalendarIngest.add_school_holidays(df=df, federal_state=federal_state)

def add_public_holidays(df: pd.DataFrame, federal_state: str):
    federal_state_holidays = holidays.CountryHoliday(country='Germany', prov=federal_state, years=[2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020])
    if 'public_holiday' not in df.columns:
        df['public_holiday'] = 'no'
    for date in df.index:
        if date in federal_state_holidays:
            df.at[date, 'public_holiday'] = federal_state_holidays[date]
    
    return df


def add_school_holidays(df: pd.DataFrame, federal_state: str): # , date: datetime.date
    for year in range(2001, 2021):
        federal_state_school_holidays = ferien.state_vacations(state_code=federal_state, year=year)
        if 'school_holiday' not in df.columns:
            df['school_holiday'] = 'no'
        index = df['Auf. Datum']
        for date in index:
            for vac in federal_state_school_holidays:
                if vac.start.date() <= date <= vac.end.date():
                    df.at[date, 'school_holiday'] = vac.name
                
    return df

Source https://stackoverflow.com/questions/69734620

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install armeria

You can download it from GitHub, Maven.
You can use armeria like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the armeria component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

Visit the community to chat with us, ask questions and learn how to contribute.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Reuse Pre-built Kits with armeria
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.