Created
April 28, 2017 06:02
-
-
Save kubaracek/31df443f7b0c35339710c74ff52f5c4c to your computer and use it in GitHub Desktop.
This file contains 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 convert_to_chronicle_format(weights: pd.Series) -> Generator[Dict[str, Dict[str, float]], Any, None]: | |
"""Take out panelprovider on the beginning of respondents | |
index and returns generator with format suitable for | |
pychronicle | |
Args: | |
weights: Series with weightings data | |
Returns: | |
generator with dicts containing respondents weighting | |
""" | |
return ( | |
{ | |
'_id': idx, | |
'_source': {'weighting': vals}, | |
'_index': # TODO, | |
'valid_at': datetime.datetime.utcnow().isoformat() | |
} for idx, vals in weights.to_dict().items() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment