Replies: 1 comment
It's because of the excess commas. The column Using pandas should work fine though... Even something like As a fallback, you can also remove json-based columns since you won't want to filter with them in excel anyways. So only give the columns you want: # I commented out some columns but you can alter this list as you need to
columns_to_include = [
"id",
"created_at",
"updated_at",
# "source",
# "structure",
"nsites",
"nelements",
"elements",
"chemical_system",
"density",
"density_atomic",
"volume",
"volume_molar",
"formula_full",
"formula_reduced",
"formula_anonymous",
"started_at",
"finished_at",
"total_time",
"queue_time",
"workflow_name",
"workflow_version",
"computer_system",
"directory",
"run_id",
"corrections",
# "band_structure_data",
"nbands",
"band_gap",
"is_gap_direct",
"band_gap_direct",
"energy_fermi",
"conduction_band_minimum",
"valence_band_maximum",
"is_metal",
"spacegroup_id",
]
df = MyTable.objects.to_dataframe(columns_to_include)
df.to_csv("example.csv") |
Uh oh!
There was an error while loading. Please reload this page.
When downloading data from database tables (both via pandas as well as through external software like Beekeeper Studio) I am getting excess columns and rows filled with numbers that do not seem to have a meaning. This is making it difficult to sort/filter through the data because one column that is meant to have standard values (such as formula_anonymous, where all of the entries should be in the format "ABx") now also has random values such as "-2.1349". I'm not sure if this is due to the way my csv is being converted (i.e. things that aren't supposed to be their own column are being formatted that way due to excess commas?) or if this is intrinsic to the data. I've attached an example of a table I tried to download via Beekeeper Studio (compressed because the original file was too large).
public_workflows_bandstructurecalc_export_2023-07-18_142748.zip
All reactions