Category : dataset

I’m trying to define the file processing methods before parsing the file. Consequently, I’m getting ‘NoneType’ object has no attribute ‘fillna error. import zipfile import pathlib import statistics import pandas as pd import numpy as np class DataProcessing: def __init__(self, df=None, file=None, duplicates=None, uninformative=None, mhealth_dataset=None): self.df = df self.file = file self.duplicates = duplicates self.uninformative ..

Read more

I want to extract and process all the files in a zipped file? import re import zipfile import pathlib import pandas as pd # Download mHealth dataset def parse(zip_file): # Extract all the files in output directory with zipfile.ZipFile(zip_file, "r") as zfile: for file in zfile.extractall(): if file.is_file(): old_name = file.stem extension = file.suffix directory ..

Read more

In the function down below, I am trying to normalize prices (converting them to percentage differences from the starting price) in dataframes contained in a list of dataframes. Each dataframe has two columns: date and price. def normalize_windows(window_data: List[DataFrame]): starting_price = window_data[0][‘price’].values[0] for window in window_data: for index, row in window.iterrows(): window.at[index, ‘price’] = (row[‘price’] ..

Read more