Created
November 15, 2023 23:40
-
-
Save phpmaps/19482d9bb52a875682e9dd7edac34b85 to your computer and use it in GitHub Desktop.
Python CSV
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
import pandas as pd | |
# Specify the CSV file path | |
csv_file_path = 'your_file.csv' | |
# Specify the column name you want to print | |
column_name = 'your_column_name' # Change this to the actual column name | |
# Read the CSV file into a pandas DataFrame | |
df = pd.read_csv(csv_file_path) | |
# Check if the specified column exists in the DataFrame | |
if column_name in df.columns: | |
# Print the specified column | |
print(df[column_name]) | |
else: | |
print(f"Column '{column_name}' not found in the CSV file.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment