<jupyter_start><jupyter_text>BackgroundTurns out there were some dropped nodes, so their host group wasn't coded up properly. I have found out which of those they are, and asked Nichola for help coding up them.In this notebook, I will recombine them together into a single CSV file that can be used.<jupyter_code>import pandas as pd
import networkx as nx
import numpy as np
G = nx.read_gpickle('20141103 All IRD Final Graph.pkl')
# Get a set of 'country:host species' mappings:

country_host = set()
for n, d in G.nodes(data=True):
    country = d['country']
    host = d['host_species']
    country_host.add((country, host))
    
country_host_new = pd.DataFrame(list(country_host))
country_host_new.columns = ['Country', 'Species']
country_host_new
country_host_old = pd.read_csv('Country-Species_to_be_Coded_by_Nichola.csv', index_col=0)
country_host_old
country_host_comb = pd.merge(country_host_new, country_host_old, on=['Country', 'Species'], how='outer')
country_host_comb[country_host_comb['Habitat/setting'].isnull()].to_csv('Country-Species_to_be_coded_replenished.csv')
country_host_comb = pd.read_csv('Country-Species_to_be_coded_replenished_NH.csv', index_col=0).sort()
country_host_comb
master = pd.concat([country_host_comb, country_host_old]).reset_index(drop=True)
master.to_csv('Country-Species_coded.csv')
master<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.106539309331374, 'fraction_numerical': 0.0073475385745775165, 'mean_word_length': 7.155688622754491, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '272342', 'license': 'MIT', 'n_tokens_mistral': 477, 'n_tokens_neox': 460, 'n_words': 111, 'path': 'Compile together host ecotype coding.ipynb', 'repo_name': 'ericmjl/influenza-reassortment-analysis', 'size': '1361'}