This project aims to visualize and statistically analyze data from little red book, providing users with recommended locations, popular posts, and relevant statistical information. The project uses Streamlit for visualization, Folium for map display, and Matplotlib and WordCloud for statistical analysis. You can check out the streamlit deployment here: https://xhsvisualization.streamlit.app/
├── data
│ ├── xhs_data.json
│ ├── xhs_data_converted.csv
├── pages
│ ├── map.py
│ ├── statistics.py
├── src
│ ├── data_processing.py
│ ├── icons.py
│ ├── popup.py
├── .gitignore
├── requirements.txt
├── README.md
-
Run the project
You can run the two Streamlit applications separately:
map.py
: For visualizing recommended locations and related posts.statistics.py
: For displaying statistical information such as word clouds, location counts, and top posts.
Run the following commands to start the applications:
streamlit run pages/map.py streamlit run pages/statistics.py
-
Browse the features
- Location Recommendation Visualization: In
map.py
, you can select different locations and categories. The map will update automatically to show relevant recommended locations and posts. - Statistical Information: In
statistics.py
, you can choose different statistical views such as word clouds, location counts, and top posts.
- Location Recommendation Visualization: In
This script is used for visualizing recommended locations and related posts. Main features include:
- Loading data from
xhs_data.json
. - Displaying the map using Folium and Streamlit, allowing users to select different locations and categories.
- Focusing the map on the selected location and displaying relevant posts in the sidebar.
This script is used for displaying statistical information. Main features include:
- Loading and preprocessing data from
xhs_data_converted.csv
. - Displaying word clouds, location counts, and top posts.
- Providing multiple views that users can select from the sidebar.
This script contains functions for data processing, mainly:
load_data
: Function for loading data.
This script contains functions for defining and retrieving icons, mainly:
get_icon
: Retrieve the corresponding icon based on the category.categories_to_icons_html
: Convert categories to HTML representations of icons.categories_to_emojis
: Convert categories to emojis.
This script contains functions for creating popup content, mainly:
create_popup_html
: Create HTML content for popups based on location, title, image, link, likes, collections, comments, and categories.
data/xhs_data.json
: JSON file containing recommended locations and posts data.data/xhs_data_converted.csv
: CSV file containing converted XiaoHongShu data.