Skip to content

Commit

Permalink
Remove unused methods (fix #231)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjello committed Nov 28, 2024
1 parent 21882fb commit 47fb955
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions openfisca_survey_manager/surveys.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,47 +165,6 @@ def fill_store(self, source_format = None, tables = None, overwrite = True, keep
)
self.dump()

def find_tables(self, variable, tables = None, rename_ident = True):
"""Find tables containing a given variable."""
container_tables = []

assert variable is not None

if tables is None:
tables = self.tables
tables_index = self.tables_index
for table in tables:
if table not in tables_index:
tables_index[table] = self.get_columns(table)
if variable in tables_index[table]:
container_tables.append(table)
return container_tables

def get_columns(self, table, rename_ident = True):
"""Get columns of a table."""
assert table is not None
if self.hdf5_file_path is not None:
store = pandas.HDFStore(self.hdf5_file_path, "r")
if table in store:
log.debug(f"Building columns index for table {table}")
data_frame = store[table]
if rename_ident is True:
for column_name in data_frame:
if ident_re.match(column_name) is not None:
data_frame.rename(columns = {column_name: "ident"}, inplace = True)
log.info(f"{column_name} column have been replaced by ident")
break
store.close()
return list(data_frame.columns)
else:
log.info(f'table {table} was not found in {store.filename}')
store.close()
return list()
elif self.parquet_file_path is not None:
parquet_schema = pq.read_schema(self.parquet_file_path)
column_names = parquet_schema.names
return column_names

def get_value(self, variable, table, lowercase = False, ignorecase = False):
"""Get variable value from a survey table.
Expand Down

0 comments on commit 47fb955

Please sign in to comment.