Python Forum
Storing data in readable place
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Storing data in readable place
#1
Greetings,

I am loading in my chosen files of a special format from a folder I read in and then converted these files to dataframes. I want to store each of these files somewhere, along with some details from it. For example:
column 1 would be named 'data files' and the entries would be the loaded in files
column 2 would be named 'shares' and the entries would be some calculated values I did elsewhere in the code
column 3 would be named 'file contents' and the entries would be the contents of the files (now dataframes)

Thanks a bunch. I don't think I am keen on dictionaries since I can't easily give the columns names that aren't "key" or "value"

What is the best way to achieve this?
Reply
#2
You really need to clarify what you are trying to do...

"I want to store each of these files somewhere" - For example, you don't store files in dataframes, you store the contents of files...

What kind of data is this? Dataframes are great for spreadsheet type data... other things, maybe not so much.

"column 2 would be named 'shares' and the entries would be some calculated values I did elsewhere in the code"

Typically a single result is stored in a single column, not multiple entries. I mean it's possible... but unless you have a good reason for doing so use multiple columns.

"column 3 would be named 'file contents' and the entries would be the contents of the files (now dataframes)"

This implies you will be storing dataframes inside of dataframes... technically possible but probably a bad idea....

Clarify what you need to do.
Gribouillis likes this post
Reply
#3
(Jul-20-2024, 02:50 PM)sawtooth500 Wrote: You really need to clarify what you are trying to do...

"I want to store each of these files somewhere" - For example, you don't store files in dataframes, you store the contents of files...

What kind of data is this? Dataframes are great for spreadsheet type data... other things, maybe not so much.

"column 2 would be named 'shares' and the entries would be some calculated values I did elsewhere in the code"

Typically a single result is stored in a single column, not multiple entries. I mean it's possible... but unless you have a good reason for doing so use multiple columns.

"column 3 would be named 'file contents' and the entries would be the contents of the files (now dataframes)"

This implies you will be storing dataframes inside of dataframes... technically possible but probably a bad idea....

Clarify what you need to do.

Thank you for responding and offering your input. I have a list of XML files that contain data from experiments. I want to load in the files (I have done this already) and then store the filenames and content in some sort of table (or any other suggestion if there is a better way). I want this 'table' to have the same columns as listed above.

I converted the XML file data to dataframes only because I thought it would be good for when I need to plot graphs from it but if you have better suggestions please let me know as I am quite new to python.

Thanks a bunch!!
Reply
#4
(Jul-21-2024, 07:52 PM)user_404_lost_and_found Wrote:
(Jul-20-2024, 02:50 PM)sawtooth500 Wrote: You really need to clarify what you are trying to do...

"I want to store each of these files somewhere" - For example, you don't store files in dataframes, you store the contents of files...

What kind of data is this? Dataframes are great for spreadsheet type data... other things, maybe not so much.

"column 2 would be named 'shares' and the entries would be some calculated values I did elsewhere in the code"

Typically a single result is stored in a single column, not multiple entries. I mean it's possible... but unless you have a good reason for doing so use multiple columns.

"column 3 would be named 'file contents' and the entries would be the contents of the files (now dataframes)"

This implies you will be storing dataframes inside of dataframes... technically possible but probably a bad idea....

Clarify what you need to do.

Thank you for responding and offering your input. I have a list of XML files that contain data from experiments. I want to load in the files (I have done this already) and then store the filenames and content in some sort of table (or any other suggestion if there is a better way). I want this 'table' to have the same columns as listed above.

I converted the XML file data to dataframes only because I thought it would be good for when I need to plot graphs from it but if you have better suggestions please let me know as I am quite new to python.

Thanks a bunch!!

So this also includes storing multiple dataframes in a 'table'
Reply
#5
If you have your data as pandas dataframes, you can easily export the df as csv or xlsx or even json, I believe.

If you provide some sample data, that would be helpful in helping you!

Look up "How to rename the columns of a pandas dataframe".
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter: Problem with storing data from one window to the other iforire 1 420 May-11-2025, 01:31 PM
Last Post: deanhystad
  tkinter only storing last element/data from entry widget bertschj1 8 987 May-06-2025, 11:54 PM
Last Post: deanhystad
  LLM data I/O - for storing notes Alkanet 0 466 Dec-19-2024, 09:08 AM
Last Post: Alkanet
  io.UnsupportedOperation: not readable RedSkeleton007 2 21,795 Nov-06-2023, 06:32 AM
Last Post: gpurdy
  place 2 windows exactly above each other janeik 3 2,561 Jul-23-2023, 03:12 AM
Last Post: deanhystad
  How to make x-axis readable with matplotlib Mark17 7 7,590 Mar-01-2022, 04:30 PM
Last Post: DPaul
  Function global not readable by 'main' fmr300 1 2,210 Jan-16-2022, 01:18 AM
Last Post: deanhystad
  Help with storing temp data for each day then recording min/max in app. trthskr4 3 3,593 Sep-10-2021, 10:51 PM
Last Post: trthskr4
  Cannot 'break' from a "for" loop in a right place tester_V 9 5,717 Feb-17-2021, 01:03 AM
Last Post: tester_V
  Problem with storing data in SQLAlchemy db marcello86 1 3,458 Aug-31-2020, 09:44 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020