Pandas data from stdin
NickName:Fra Ask DateTime:2013-08-29T02:44:27

Pandas data from stdin

Is it possible to have stdin data go into a pandas DataFrame?

Currently I'm saving the data in an intermediate json file and then doing:

pandas.read_json('my_json_file.json')

but was wondering if it's possible to pipe the stdin directly in the python script. I found this: How to read from stdin or from a file if no data is piped in Python? but not sure how to do a line-by-line insertion in a pandas DF.

Copyright Notice:Content Author:「Fra」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/18495846/pandas-data-from-stdin

More about “Pandas data from stdin” related questions

Pandas data from stdin

Is it possible to have stdin data go into a pandas DataFrame? Currently I'm saving the data in an intermediate json file and then doing: pandas.read_json('my_json_file.json') but was wondering i...

Show Detail

using pandas read_excel to read from stdin

Note: I have solve this problem as per below: I can use to_csv to write to stdout in python / pandas. Something like this works fine: final_df.to_csv(sys.stdout, index=False) I would like to re...

Show Detail

Convert Pandas dataframe to format suitable for PostgreSQL COPY ... FROM STDIN

Given a Pandas dataframe, how can it be converted to a form suitable for PostgreSQL's COPY FROM STDIN (ideally in TEXT mode)? A naive way would be: text = df.to_csv( index=False, header=Fal...

Show Detail

How to write binary data to stdin and read data from stdout without closing stdin?

I have a program that writes binary data to stdin and reads it from stdout. But the program freeze and does not allow reading data from stdout until stdin is closed, how to avoid this behavior? I w...

Show Detail

dart pass data from stdin and stderr to stdin of another process

This is really a follow in question from: Dart: How to pass data from one process to another via streams I using dart to spawn two processes. Lets call these two processes 'lhs' and 'rhs'. (lhs ...

Show Detail

How to write data to stdin to be consumed by a separate thread waiting on input from stdin?

I am trying to read some data from stdin in a separate thread from main thread. Main thread should be able to communicate to this waiting thread by writing to stdin, but when I run the test code (

Show Detail

cURL : Sending part data from stdin in POST

I've to make 2 cURLs. The data from 1 curl needs to be formatted & sent as an input in the 2nd cURL. I've attempted the following: curl -XPOST -H "Content-type: application/json" -d '{"a":1,...

Show Detail

Python - eval and show size of data read from stdin

I have a Python script that read lines from stdin such as: # Read nmon data from stdin data = sys.stdin.readlines() # Number of lines read nbr_lines = len(data) # Show current time and number of...

Show Detail

Determine if Stdin has data with Go

Is there a way to check if the input stream (os.Stdin) has data? The post Read from initial stdin in GO? shows how to read the data, but unfortunately blocks if no data is piped into the stdin.

Show Detail

Python-opencv: Read image data from stdin

How can I read image data from stdin rather than from a file? With the C++ interface, it seems to be possible: https://stackoverflow.com/a/5458035/908515. The function imdecode is available in Pyt...

Show Detail