stats step 3: elections, party positions and opinion feeds (schema, collectors, timers); world-opinions data moved into stats.wo_*
All checks were successful
Deploy production / deploy (push) Successful in 1m12s
All checks were successful
Deploy production / deploy (push) Successful in 1m12s
This commit is contained in:
14
scripts/stats/vparty-csv.py
Normal file
14
scripts/stats/vparty-csv.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# Convert V-Dem's vparty.RData to CSV on stdout (selected columns only). Run with the stats
|
||||
# Python venv (pyreadr + pandas): ~/.local/share/stats-py/bin/python vparty-csv.py file.RData
|
||||
import sys
|
||||
|
||||
import pyreadr
|
||||
|
||||
COLS = [
|
||||
"v2paid", "pf_party_id", "CHES_ID", "country_text_id", "year", "v2paenname", "v2pashname",
|
||||
"v2pavote", "v2paseatshare", "v2xpa_popul", "v2xpa_antiplural", "v2pariglef", "v2paimmig",
|
||||
"v2palgbt", "v2parelig", "v2pawelf", "v2paculsup",
|
||||
]
|
||||
frames = pyreadr.read_r(sys.argv[1])
|
||||
df = next(iter(frames.values()))
|
||||
df[[c for c in COLS if c in df.columns]].to_csv(sys.stdout, index=False)
|
||||
Reference in New Issue
Block a user