Pandas Pandas input output

We can read the copied data from the clip board to Pandas DataFrame.
import pandas as pd 
my_data = pd.read_clipboard() # reading from your clipboard 

  • read_clipboard() DataFrame using Data from Board

Visit this Page about DataFrame and copy the first output table using your mouse.
After copying just run the above code.

Output is here ( This depends on what you have copied.)
0  Ravi   1    30       20
1  Raju   2    40       30
2  Alex   3    50       40

Storing data in CSV or Excel file

We can store the output in csv file by using to_csv() or by using Excel file.
import pandas as pd 

my_data = pd.read_clipboard()
Next time by using your mouse select data in any web page ( url ) or excel file or any other Tabular data. Run the above code and take your CSV or Excel file from D drive ( or location of your choice ) .

Creating HTML page by using to_html()

We can use the clipboard data to create HTML tables and save the file as web page or in .html format by using to_html(). Here is the code.
import pandas as pd 

my_data = pd.read_clipboard()
HTML file using Clipboard data
The above code will create my_html.html file at D Drive ( change the location if you want ) . The source code of this file is here
<table border="1" class="dataframe">
    <tr style="text-align: right;">

Data input and output from Pandas DataFrame
Pandas to_clipboard() read_excel() to_csv() to_excel()
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2023 All rights reserved worldwide Privacy Policy Disclaimer