I am building a dataframe from a directory of text files that contain memory readings. I am giving the column the name Memory
.
But when the data gets imported there is a column of zeros, the column with the memory readings that I want, and the Memory
column has an NaN
by each entry (not a number, I presume):
output:
***Memory Data Frame:
0 Memory
0 1843260.0 NaN
0 7706164.0 NaN
0 7904828.0 NaN
0 7706164.0 NaN
0 7706172.0 NaN
0 7648524.0 NaN
0 7648524.0 NaN
0 7706172.0 NaN
0 7706164.0 NaN
0 7904828.0 NaN
0 7706172.0 NaN
0 7648524.0 NaN
0 7706172.0 NaN
0 16075888.0 NaN
0 7904672.0 NaN
0 7904680.0 NaN
0 7904672.0 NaN
0 7904680.0 NaN
0 16075880.0 NaN
0 7904672.0 NaN
***
I'm not sure why the data is misaligned with a row of all zeros, the memory readings are floats with a trailing .0
, or why there's a row of NaN in the Memory
column. Here is my most recent code.
code:
# Create the memory dataframe
column_names = ["Memory"]
memory_df = pd.DataFrame(columns = column_names)
memory_df.astype('int32').dtypes
temp_df = pd.DataFrame(columns = column_names)
temp_df.astype('int32').dtypes
print(f"Reading text files into the Memory DF")
for filename in filelist:
print(f"Adding filename: {filename}")
filename = text_path + filename
temp_df = pd.read_csv(filename, delim_whitespace=True, header=None)
temp_df.astype('int32').dtypes
memory_df = memory_df.append(temp_df)
How can I ingest the data with JUST one Memory
column with the memory readings shown as integers with no trailing .0
?