Skip to content

Commit

Permalink
Some more work with pandas
Browse files Browse the repository at this point in the history
  • Loading branch information
ybressler committed May 29, 2024
1 parent 5ad576f commit ebc4da2
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/process_data/pandas/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"""
Process the stuff in pandas
"""
import numpy as np

import argparse

import pandas as pd


Expand Down Expand Up @@ -64,8 +66,9 @@ def in_chunks(cls, filename: str, chunksize: int = 100_000):
# "mean": lambda s: sum(s['count'] * s['mean']) / sum(s['count']),
# }
# )
def calc_mean():
...

def calc_mean(): ...

# Now aggregate at the end (count * mean / count)
# tmp = df_result.groupby(level=0).agglambda s: pd.Series({
# "corr(x, y)": np.corrcoef(s["x"], s["y"]),
Expand All @@ -82,9 +85,9 @@ def calc_mean():


if __name__ == "__main__":
# parser = argparse.ArgumentParser(description="Analyze measurement file")
# parser.add_argument("-f", "--file_name", dest="file_name", type=str, help="File name")
# args = parser.parse_args()
file_name = "src/create_data/tmp/measurements.txt"
df = PandasThing.in_chunks(file_name)
z = df.head()
parser = argparse.ArgumentParser(description="Analyze measurement file")
parser.add_argument("-f", "--file_name", dest="file_name", type=str, help="File name")
args = parser.parse_args()

df = PandasThing.in_memory(args.file_name)
print(df.head())

0 comments on commit ebc4da2

Please sign in to comment.