Pandas: Create a DataFrame from the clipboard
Pandas: DataFrame Exercise-79 with Solution
Write a Pandas program to create a DataFrame from the clipboard (data from an Excel spreadsheet or a Google Sheet).
Sample Excel Data:

Sample Solution :
Python Code :
import pandas as pd
df = pd.read_clipboard()
print("Data from clipboard to DataFrame:")
print(df)
Sample Output:
Data from clipboard to DataFrame: 1 2 3 4 0 2 3 4 5 1 4 5 1 0 2 2 3 7 8
Python-Pandas Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Pandas program to replace the current value in a dataframe column based on last largest value. If the current value is less than last largest value replaces the value with 0.
Next: Write a Pandas program to check for inequality of two given DataFrames.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
Python: Tips of the Day
Join Strings in an Iterable:
>>> words = ('Hello', 'Python', 'Programmers') >>> '!'.join(words) 'Hello!Python!Programmers' >>> words_dict = {0: 'zero', 1: 'one', 2: 'two', 3: 'three'} >>> '&'.join(words_dict.values()) 'zero&one&two&three'
- Exercises: Weekly Top 12 Most Popular Topics
- Pandas DataFrame: Exercises, Practice, Solution
- Conversion Tools
- JavaScript: HTML Form Validation
- SQL Exercises, Practice, Solution - SUBQUERIES
- C Programming Exercises, Practice, Solution : For Loop
- Python Exercises, Practice, Solution
- Python Data Type: List - Exercises, Practice, Solution
- C++ Basic: Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - exercises on Employee Database
- SQL Exercises, Practice, Solution - exercises on Movie Database
- SQL Exercises, Practice, Solution - exercises on Soccer Database
- C Programming Exercises, Practice, Solution : Recursion