Skip to main content

wosfile

codecov

wosfile is a Python package designed to read and handle data exported from Clarivate Analytics Web of Science™. It supports both tab-delimited files and so-called ‘plain text’ files.

The point of wosfile is to read export files from WoS and give you a simple data structure—essentially a dict—that can be further analyzed with tools available in standard Python or with third-party packages. If you're looking for a ‘one-size-fits-all’ solution, this is probably not it.

Pros:

  • It has no requirements beyond Python 3.6+ and the standard library.
  • Completely iterator-based, so useful for working with large datasets. At no point should we ever have more than one single record in memory.
  • Simple API: usually one needs just one function wosfile.records_from().

Cons:

  • Pure Python, so might be slow.
  • At the moment, wosfile does little more than reading WoS files and generating Record objects for each record. While it does some niceties like parsing address fields, it does not have any analysis functionality.

Examples

These examples use a dataset exported from Web of Science in multiple separate files. The maximum number of exported records per file is 1000 (or 5000, depending on how much metadata you need).

Subject categories in our data

import glob
import wosfile
from collections import Counter

subject_cats = Counter()
# Create a list of all relevant files. Our folder may contain multiple export files.
files = glob.glob("data/savedrecs*.txt")

# wosfile will read each file in the list in turn and yield each record
# for further handling
for rec in wosfile.records_from(files):
    # Records are very thin wrappers around a standard Python dict,
    # whose keys are the WoS field tags.
    # Here we look at the SC field (subject categories) and update our counter
    # with the categories in each record.
    subject_cats.update(rec.get("SC"))

# Show the five most common subject categories in the data and their number.
print(subject_cats.most_common(5))

Citation network

For this example you will need the NetworkX package. The data must be exported as ‘Full Record and Cited References’.

import networkx as nx
import wosfile

# Create a directed network (empty at this point).
G = nx.DiGraph()
nodes_in_data = set()

for rec in wosfile.records_from(files):
    # Each record has a record_id, a standard string uniquely identifying the reference.
    nodes_in_data.add(rec.record_id)
    # The CR field is a list of cited references. Each reference is formatted the same
    # as a record_id. This means that we can add citation links by connecting the record_id
    # to the reference.
    for reference in rec.get("CR", []):
        G.add_edge(rec.record_id, reference)

# At this point, our network also contains all references that were not in the original data.
# The line below ensures that we only retain publications from the original data set.
G.remove_nodes_from(set(G) - nodes_in_data)
# Show some basic statistics and save as Pajek file for visualization and/or further analysis.
print(nx.info(G))
nx.write_pajek(G, 'network.net')

Other Python packages

The following packages also read WoS files (+ sometimes much more):

Other packages query WoS directly through the API and/or by scraping the web interface:

Metadata

Release files for wosfile 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wosfile 0.7.0
File Size Uploaded
wosfile-0.7.0.tar.gz 12.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wosfile 0.7.0
File Interpreter ABI Platform
wosfile-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.3 kB

Release files / wosfile-0.7.0.tar.gz

Download URL wosfile-0.7.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
88fdd9c8b42a39f226e4e4cfecf8d0688c0df982a44a472dd91897f747c9e05a
BLAKE2b-256 checksum
How to use checksums
4fe9ecd8756440af807b5a7e9f62dce3f37536617f6e42606cc11cce8d0fa305
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.7

Release files / wosfile-0.7.0-py3-none-any.whl

Download URL wosfile-0.7.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
269433b5505a875b883b47bcfb1788e44650d509a7977b2cfba716468b760c11
BLAKE2b-256 checksum
How to use checksums
abff3e48b39dfedda2dac5ebd490d69a2881d9dfae70dde7f85fe35afe77ca0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.7

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6

2 release files

0.5

2 release files

0.4.2

2 release files

0.4.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page