Created
May 2, 2020 17:25
-
-
Save shenkev/db4d40e79a542f9d0a06edbf2bec1c9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_dict(path): | |
type_map = { | |
**{k: np.uint8 for k in range(0, 4)}, | |
**{k: np.float32 for k in range(4, 4+297)}, | |
**{k: np.float32 for k in range(301, 369)}, | |
**{k: np.int32 for k in range(370, 372)}, | |
} | |
df = pd.read_csv(path, dtype=type_map, header=None) | |
dic = { | |
"labels": np.array(df[range(0, 4)]), | |
"tokens": np.array(df[range(4, 4+297)]), | |
"features": np.array(df[range(301, 369)]), | |
"tweet_ids": np.array(df[range(369, 370)]), | |
"ids": np.array(df[range(370, 372)]), | |
} | |
return dic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment