read_clipboard() Read Clipboard data to create DataFrame
import pandas as pd
df = pd.read_clipboard() # reading from your clipboard
print(df)
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.)
NAME ID MATH ENGLISH
0 Ravi 1 30 20
1 Raju 2 40 30
2 Alex 3 50 40
read_clipboard(): Read the clipboad data and create DataFrame #B12
Parameters
sep : By default space is used as separator, we can specify any string or regex delimiter. engine : Change the default engine if you are getting this error.
ParserWarning: Falling back to the 'python' engine because the separator encoded in utf-8 is > 1 char long, and the 'c' engine does not support such separators; you can avoid this warning by specifying engine='python'
Using sep and engine
To copy Functions with Descripitions from the PHP manual here we have to use different delimiter as space is not used here.
import pandas as pd
df = pd.read_clipboard()
print(df)
df.to_csv('D:\my_clipboard.csv')# path with file name to store
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 ) .
Use the above code to create one Excel file having all the PHP String functions with description as given in PHP manual.
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
df = pd.read_clipboard()
print(df)
df.to_html('D:\my_html.html') # change the path to store
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